Sign in to follow this  
beebs1

Error Reporting in Libraries

Recommended Posts

Hiya, I'd be really interested to hear how people prefer 'middleware' libraries to report errors. There doesn't seem to be a standard way of doing this - DirectX returns error-codes, C++ STL throws exceptions, and some libraries like XAudio force a breakpoint when an error is detected - and just ignore them in release builds. I currently use exceptions when writing libraries, and sometimes a Sink interface which clients can inherit from to log errors - e.g. in scripting system. My current project relies on DLLs though, and I believe exceptions can cause problems, due to differences in the way different compilers handle them. Are there any best practices for this sort of this? Could anyone tell me how you handle this? Thanks in advance for any comments!

Share this post


Link to post
Share on other sites
I think error codes are the best. I use error codes for any of my internal methods (I dont have anything near as organized as a library!). I also prefer it (similar to WinSock and DirectX) because it allows me to output errors very easily, and it seems more intuitive (to me) than catching exceptions.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this