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

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -