G
Guest
Hi, I've been asked to write some code that only logs "serious exceptions" (a
client... long story). I'm a somewhat young programmer and started w/ .net so
I haven't been exposed to Com and Hresults before.
My question is: I know that all .net exceptions have an HRESULT protected
property. Is it true that there's a relationship between an error/exceptions
"level of severity" and its HResult value?
For instance:
The HResult for a common error such as System.NullReferenceException is:
0x80004003 (Reflector has the integer value as: 2147467261)
The HResult for an exception that signifies serious trouble such as
System.ExecutionEngineException is: 0x80131506. Aka 2146233082
Would it be possible for me to define an HRESULT "threshold" and log all
exceptions that are above or below such a value? Or is there no
relationship between severity and an exception's HRESULT value? I suppose
the other alternative is to use multiple exception filters but assuming that
my "relationship" assumption is correct the user one if statement would be
more simple and scalable.
I know the Logging Block in the new Enterprise Library can do this but I’ve
been asked to implement a solution in the next couple of days and haven’t
delved far enough into the Enterprise library to use it in a real project yet.
client... long story). I'm a somewhat young programmer and started w/ .net so
I haven't been exposed to Com and Hresults before.
My question is: I know that all .net exceptions have an HRESULT protected
property. Is it true that there's a relationship between an error/exceptions
"level of severity" and its HResult value?
For instance:
The HResult for a common error such as System.NullReferenceException is:
0x80004003 (Reflector has the integer value as: 2147467261)
The HResult for an exception that signifies serious trouble such as
System.ExecutionEngineException is: 0x80131506. Aka 2146233082
Would it be possible for me to define an HRESULT "threshold" and log all
exceptions that are above or below such a value? Or is there no
relationship between severity and an exception's HRESULT value? I suppose
the other alternative is to use multiple exception filters but assuming that
my "relationship" assumption is correct the user one if statement would be
more simple and scalable.
I know the Logging Block in the new Enterprise Library can do this but I’ve
been asked to implement a solution in the next couple of days and haven’t
delved far enough into the Enterprise library to use it in a real project yet.