jeudi 9 avril 2015

Sql Nhibernate Exceptions with Sqlite and C# and known error codes

In my project I use Sqlite with Nhibernate and now I want to manage the error handling for my repository.


I found this very nice link, but it has the error codes for SQL Server:


http://ift.tt/1yg1iLT


So far so good.


This is the code for error handling in SQL Server:



case 547:
return new ConstraintViolationException(exInfo.Message, sqle.InnerException, exInfo.Sql, null);

case 208:
return new SQLGrammarException(exInfo.Message, sqle.InnerException, exInfo.Sql);

case 3960:
return new StaleObjectStateException(exInfo.EntityName, exInfo.EntityId);


The problem is that I only know the first one. In Sqlite, the error code is 19 for ConstraintViolationException. But for the other ones I can't find an homologation. I checked for it here:


http://ift.tt/1KexVib


The question is:




  • Does anybody has experience with Sqlite error handling and know which error codes I could handle?




  • Is there an homologation for SQLGrammarException and StaleObjectStateException?




  • Are there more Error codes that I could/should handle?




Thanks for any heads up,


John


Aucun commentaire:

Enregistrer un commentaire