About exceptions handling

D

Diego F.

Hi all. I have a doubt about exception.

If I have a large method that can throw an exception in many lines, and I
have the mehtod inside a try-catch block, how can I know where the exception
is throwed exactly?
 
A

Armin Zingler

Diego F. said:
Hi all. I have a doubt about exception.

If I have a large method that can throw an exception in many lines,
and I have the mehtod inside a try-catch block, how can I know where
the exception is throwed exactly?

If you want to distinguish between the different locations within the code,
you must split the code and put Throw/Catch around each part.


Armin
 
D

Diego F.

Armin Zingler said:
If you want to distinguish between the different locations within the
code,
you must split the code and put Throw/Catch around each part.


Armin

That is what I thought, thank you.
 
R

rowe_newsgroups

Hi all. I have a doubt about exception.

If I have a large method that can throw an exception in many lines, and I
have the mehtod inside a try-catch block, how can I know where the exception
is throwed exactly?

--

Regards,

Diego F.

In addition to Armin (who imo gave the correct answer),

If you are catching the exception at debug time, the exception object
will most generally include the line number that threw the exception.
While that tidbit of info probably isn't the solution to your problem,
it may help searchers of the newsgroup archive.

Thanks,

Seth Rowe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top