recommended error handling

Saaa empty at needmail.com
Tue Apr 8 15:41:38 PDT 2008


Thanks!

>
> I always convert those errors to exceptions, if only for the reason that I
> want errors to be handled in a uniform way. Take a look at this blog for a
> sweet way to wrap those functions:
> http://while-nan.blogspot.com/2007/06/wrapping-functions-for-fun-and-profit.html
>
> Where you catch the exception depends on where you could handle it. For
> example if you can't load a texture, replace it with a standard one and go
> on. That might be sane or not, it depends. Thus the first question is: how
> critical is this Exception, should it take down the application or can I
> somehow repair it and go on?
>
> It's also important to distinguish between Errors and Exceptions. 
> Exceptions
> can occur in a 100% bugfree program, errors are always bugs. I don't think
> it's reasonable (for me at least) to only check for errors in a debug
> build, so with errors you might want to log them in a file before shutting
> down and requesting a bug report from the user in a dialog.
>
> 




More information about the Digitalmars-d-learn mailing list