Closed aryairani closed 2 years ago
I think it is better if the user can still get the primary result code. With this commit, errcode
always produces the extended result code, breaking backward compatibility.
So, instead of changing the existing errcode
, a new function extendedErrcode
should be implemented that produces the extended result code.
Additionally, perhaps a function toPrimaryError
could be implemented to convert an extended result code to the underlying primary result code as described in point 2 here: https://www.sqlite.org/rescode.html
This PR switches from using
sqlite3_errcode
tosqlite3_extended_errcode
, as part of an unsuccessful* attempt to get more info about aSQLITE_IOERR
I was getting in mydirect-sqlite
application, that I thought might be desirable in the main line.For better or worse, it would require users to reevaluate any pattern matching they were doing on
Error
values; it may also cause matches for (for example)ErrorIO
vs_
to hit the_
case instead of theErrorIO
case, if sqlite returns something more specific.Also for better or worse, I continued the existing pattern of including the apostrophized word
Can't
in the error constructors.Let me know what you think, and if you would like to see some changes.
I haven't seen sqlite actually return an extended error code, and I don't know how to trigger one as a test, so I'm not sure if it's working, but it builds and the existing tests pass, so that's something.