Java return line of the error
Hi all,
Iam trieing to print an error with a linenumber where the error is at.
Here is a part of my code.
Code:
if (turns.isEmpty())
{
throw new FileException("\r\nTurn <" + turns + "> contains zero darts" , i , file, turns);
}
What i would like to show at i is the linenumber where the error is.
turns is filled by inserting a file Code:
while((turns = reader.readLine()) != null)
Re: Java return line of the error
I think there is a way to get the contents of the stack trace into a variable.
Then you would have to scan the contents of that variable to find the line number you are interested in.