J
Jonathan Wood
I must be the only one who doesn't think exceptions are the greatest thing
since bread.
Consider the following code:
id = Convert.ToInt32(Request.QueryString["id"]);
First, is there an easy way to tell which methods or properties could
potentially throw an exception? I've scanned the docs and it doesn't seem to
say. Without that knowledge, it's a bit of hit and miss.
Second, knowing that ToInt32() can throw an exception, is there any way to
prevent that? The line above already appears within a try...catch. However,
I don't want the same catch handler to handle problems with this line. I'd
like it handled differently. What other choice is there besides creating an
additional try and/or catch block? And doesn't that seem like overkill?
Thanks.
since bread.
Consider the following code:
id = Convert.ToInt32(Request.QueryString["id"]);
First, is there an easy way to tell which methods or properties could
potentially throw an exception? I've scanned the docs and it doesn't seem to
say. Without that knowledge, it's a bit of hit and miss.
Second, knowing that ToInt32() can throw an exception, is there any way to
prevent that? The line above already appears within a try...catch. However,
I don't want the same catch handler to handle problems with this line. I'd
like it handled differently. What other choice is there besides creating an
additional try and/or catch block? And doesn't that seem like overkill?
Thanks.