Ticket Hash: | e073a5bc7cf65d23d9faab95e38f1a9fc1ee9213 | |||
Title: | Add possibility to distinguish exceptions | |||
Status: | Open | Type: | Feature_Request | |
Severity: | Cosmetic | Priority: | Medium | |
Subsystem: | None | Resolution: | Not_Backwards_Compatible | |
Last Modified: | 2013-07-19 22:16:43 | |||
Version Found In: | 1.0.84.0 | |||
User Comments: | ||||
anonymous added on 2013-01-22 15:51:56:
There is no way to distinguish exception (constraint failed or others) through error code or something else. I have to check and parse returned messages to determine type of exception. E.g. I have some method that translates from a returned exception to my exception: private Exception TranslateException(Exception e) { SQLiteException sqliteEx = e as SQLiteException; if (sqliteEx != null) { switch (sqliteEx.ReturnCode) { case SQLiteErrorCode.Constraint: if (sqliteEx.Message.EndsWith("may not be NULL")) return ErrorsProvider.GetException(ErrorType.NullNotAllowed, sqliteEx); if (sqliteEx.Message.EndsWith("foreign key constraint failed")) return ErrorsProvider.GetException(ErrorType.ForeignKeyViolation, sqliteEx); return ErrorsProvider.GetException(ErrorType.UniqueKeyDuplicate, sqliteEx); case SQLiteErrorCode.NotFound: return ErrorsProvider.GetException(ErrorType.ForeignKeyViolation, sqliteEx); case SQLiteErrorCode.Locked: return ErrorsProvider.GetException(ErrorType.Deadlock, sqliteEx); } } return null; } It'd be nice to have a better ways than parse returned messages. Please provide ability to distinguish by error codes. Thanks. anonymous added on 2013-01-23 18:22:36: (text/x-fossil-plain) I would like this option too. Now I am parsing the text of the message and I don't like so much this solution. |