Monday, July 17, 2006

Exception Rant Follow Up

Perhaps I'm a bit slow, but I just discovered a really cool exception class that I thought I should mention (particularly after my last little rant on exceptions).

The Win32Exception exception class from the System.ComponentModel namespace represents a Win32 error (duh!). What's cool about this is that you can pass an integer value to the constructor, normally the result of the System.Runtime.InteropServices.Marshal.GetLastWin32Error() function, and the message of the exception is automatically setup to represent the correct text for the Win32 error code provided.

Now that's cool. No more magic numbers :)

No comments:

Post a comment