I've been pondering this recently and was wondering what other folks do to provide a consistent approach to reporting database related errors (Although this could be used for other things as well I suppose).
Im working on a simple database related app that has a 'db' module. Within that module, I have a 'DBOpen' method and 2 global properties 'LastErrorCode' and 'LastErrorDescription'.
The first thing I do in 'DBOpen' is to check for FolderItemExists.
After this check, I set the database parameters and call DB.Connect.
If either of these fail, I put the error code & description into LastErrorCode and LastErrorDescription respectively, and then call a simple sheetwindow using ShowModalWithin which displays the error information and allows a clean exit from the app or return to a previous screen.
I'll be using the same method when executing sql.
It works exactly as expected, and I've been able to trip the errors for the purpose of basic testing and all is fine.
Does this seem a reasonable approach to manage error reporting to the end user, or is there a better method ?