c# - Catching an exception -
i'm getting exception thrown , message gives value not fall within expected range. i'm trying right piece of code grab exception , suppress - know issue - trying pull record list using id doesn't exist.
any ideas how go catching this?
to suppress exception need this
try { // code may throw exception. } catch (exception ex) // better use more specific exception class { // nothing - suppresses exception. // if want additional checking may continue exception // stack use "throw" on own - compiled cil/msil's // "rethrow" , doesn't drop of information // go if did "throw ex" }
that's there suppressing exception.
for sanity of have maintain code (or in 6 months time when you've forgotten specifics of why did this), comment why suppressing exception. if see code suppresses exception want know why.
Comments
Post a Comment