|
Posted by Jerry Stuckle on 10/10/05 17:13
Seamus M wrote:
> It appears the exception should be thrown on the line immediately after the
> potenially error causing code for "getLine()" to be any use. I was
> anticipating it to work like the built-in errors which tell you what line of
> code caused the error.
>
> Thanks for your input.
>
> - Seamus
>
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:ov-dnYfolKwGStTeRVn-oA@comcast.com...
>
>>Seamus M wrote:
>>
>>>It seems when I use the getLine() method of the Exception class, it
>>>returns the line number of the "throw new Exception" statement and not
>>>the line number where the error actually occured in the source file. Am
>>>I doing something wrong?
>>>
>>> - Seamus
>>
>>How is the exception supposed to know where the error occurred? It could
>>have been anything - bad return code, incorrect data, whatever. But in all
>>cases, it's something you had to detect. This might have been many lines
>>of code before you actually threw the exception, or even in a different
>>(included) file.
>>
>>All the exception can tell is where you threw it.
>>
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstucklex@attglobal.net
>>==================
>
>
>
There's a difference here. The built-in errors know where the error
occurred, because they detected the error.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|