Why I can't catch the exception?

Era Scarecrow via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 5 11:20:12 PDT 2016


On Sunday, 5 June 2016 at 18:15:47 UTC, Adam D. Ruppe wrote:
> On Sunday, 5 June 2016 at 18:02:12 UTC, Suliman wrote:
>> I really can't understand why try-catch block do not handle 
>> exception.
>> digit 1 is printing, so exception is accrue after it, but why 
>> nothing in catch block?
>>
>> http://img.ctrlv.in/img/16/06/05/57546861d8e81.png
>>
>>     catch(Exception e)
>
>
> You are catching Exception, but it is throwing Error. They are 
> two separate things.
>
> You shouldn't typically catch Error, instead try to fix the bug 
> it indicates. But you can if you want by catch(Error e)


  The assertion is being thrown in the storage.d and backtracking 
it basically points to line 115 (usersCollection), so am going to 
guess based on error messages alone that you are passing a 
struct/class that doesn't match inputs that it is expecting for 
one of the elements it needs to store.

  So my advice is to look at the User struct/class, and then look 
at the DB's User table. But this is just a far thrown guess at 
the problem.


More information about the Digitalmars-d-learn mailing list