Cumhur Ata
Cumhur Ata

Reputation: 809

get ErrorLine Number in SSJS XPages

how to get errorline number in this try catch() If an error accures.

try 
{
  //IF an error happens here show me the errorLine Number?
}
catch(e)
{
    print(e.toString());
}

Upvotes: 1

Views: 592

Answers (2)

Martijn Mulder
Martijn Mulder

Reputation: 1

Bit of a shame this openlogger is not included in the domino product. If you have no possibility to change the server configuration there is no way to use it.

Upvotes: 0

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15729

XPages OpenLog Logger automatically handles that for you, as well as catching any uncaught exceptions. I would strongly recommend using it, which is why it is also automatically included in OpenNTF Domino API. Both are Apache licensed, so there are no prohibitions to them being included in commercial code.

If you want to code that yourself, the code is open sourced. I won't include the lines here, because it is extensive. You need to identify the Java class of the SSJS exception returned and then call the relevant method in each. It took a large amount of trial and error to identify the potential Java classes relating to all SSJS exceptions. I can't guarantee I have identified them all (another reason I would recommend using XPages OpenLog Logger instead), but I have not had any defects logged for additional Java classes in the last year.

Upvotes: 5

Related Questions