Activities of "KuldeepRathi"

Hi,

We are getting issue with Exceptions while using ABP InsertSync.
For any error/exception came from SQL not getting moved in exception code and not going in catch statement. This is happening whenever we are passing false in Repository.InsertAsync().

As shown below in Option 1 code. Please suggest, we need to send custom error number like - throw new CivitException(ex.Message, "2601");

Same is working fine if we are calling direct EfCoreException

-------------------------------------------------------------------- +@ AbpException Code starts -------------------------------------------------------------------- //Option1 :- passing inner async parameter as "false".

public async Task AddOrganization(OrganizationDto input)
        {
            try
            {

                var data = ObjectMapper.Map<OrganizationDto, Setup.Organization.Organization>(input);                                
                await _orgContactRepository.InsertAsync(data, false);
                
            }
        catch (DbUpdateException ex)
            {
                throw new CivitException(ex.Message, "2601");
            }
        }

//Option2 :- passing inner async parameter as "true"

public async Task AddOrganization(OrganizationDto input)
        {
            try
            {

                var data = ObjectMapper.Map<OrganizationDto, Setup.Organization.Organization>(input);                
                await _orgContactRepository.InsertAsync(data, true);                
                
            }
            catch (DbUpdateException ex)
            {
                throw new CivitException(ex.Message, "2601");
            }
        }

------------------------------------ +@ AbpException Code Ends --------------------------------------------------------------------

----------------------------------- +@ EFCoreException Code starts --------------------------------------------------------------------

        public override int SaveChanges()
        {
            try
            {
                
                var data=base.SaveChanges();
                return data;
            }
            catch (DbUpdateException e)
            {
                Console.WriteLine(e);
                throw;
            }
        }

------------------------------------------------ +@ EFCoreException Code ends --------------------------------------------------------------------

Showing 11 to 11 of 11 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 17, 2025, 07:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.