![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I've got one main method, with a Try Catch block. In that, I catch the error and put it on a label. However, inside the Try portion, I also run another method. I have a Try/Catch block there, also, except I just have 'Throw' in the Catch portion. How can I send something from this 'internal' method, to the 'outer' method, so I can see where the actual failure is coming from? |
#3
| |||
| |||
|
|
You can remove the try/catch block from the "inside" method altogether and have the "outside" catch actually catch it. If you want to keep the try/catch inside, you can have something like: catch (Exception ex) { throw ex; } instead of just "throw" and send the exception "up", to be catched by the catch block there. Elmo Watson escreveu: I've got one main method, with a Try Catch block. In that, I catch the error and put it on a label. However, inside the Try portion, I also run another method. I have a Try/Catch block there, also, except I just have 'Throw' in the Catch portion. How can I send something from this 'internal' method, to the 'outer' method, so I can see where the actual failure is coming from? |
#4
| |||
| |||
|
|
What's the difference between 'throw' and 'throw ex'? With the 'Throw', it does get sent up to the main method - but there is nothing in the error message, that distinctly identifies it as being from the 'inner' method - What I'd like to know is how to Add something to the error message, so when the error happens, it's easily identified as being from the 'inner' method.. "zainab" <pedr... (AT) gmail (DOT) com> wrote in message news:e96d27c7-406a-43b5-9a4d-0f4412bf5a93 (AT) j20g2000hsi (DOT) googlegroups.com... You can remove the try/catch block from the "inside" method altogether and have the "outside" catch actually catch it. If you want to keep the try/catch inside, you can have something like: catch (Exception ex) { * * * * * * * *throw ex; } instead of just "throw" and send the exception "up", to be catched by the catch block there. Elmo Watson escreveu: I've got one main method, with a Try Catch block. In that, I catch the error and put it on a label. However, inside the Try portion, I also run another method. I have a Try/Catch block there, also, except I just have 'Throw' in the Catch portion. How can I send something from this 'internal' method, to the 'outer' method, so I can see where the actual failure is coming from? |
#5
| |||
| |||
|
|
What's the difference between 'throw' and 'throw ex'? With the 'Throw', it does get sent up to the main method - but there is nothing in the error message, that distinctly identifies it as being from the 'inner' method - What I'd like to know is how to Add something to the error message, so when the error happens, it's easily identified as being from the 'inner' method. "zainab" <pedralm (AT) gmail (DOT) com> wrote in message news:e96d27c7-406a-43b5-9a4d-0f4412bf5a93 (AT) j20g2000hsi (DOT) googlegroups.com... You can remove the try/catch block from the "inside" method altogether and have the "outside" catch actually catch it. If you want to keep the try/catch inside, you can have something like: catch (Exception ex) { throw ex; } instead of just "throw" and send the exception "up", to be catched by the catch block there. Elmo Watson escreveu: I've got one main method, with a Try Catch block. In that, I catch the error and put it on a label. However, inside the Try portion, I also run another method. I have a Try/Catch block there, also, except I just have 'Throw' in the Catch portion. How can I send something from this 'internal' method, to the 'outer' method, so I can see where the actual failure is coming from? |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |