Get the line number of an error

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Get the line number of an error

Post by pietro_72_ » Thu Dec 12, 2019 8:08 am

Hi

Is it possible to get the line number of the code in which an error occurs with the following system?

try {
     .......
     ............
     .........
}
catch (e) {
     EAction.handleUserMessage ("");
     EAction.handleUserMessage ("Start error tracking");
     EAction.handleUserMessage (e.name);
     EAction.handleUserMessage (e.Message);
     EAction.handleUserMessage ("Error:" + e);
     EAction.handleUserMessage (e.fileName);
     EAction.handleUserMessage ("End tracking Error");
     EAction.handleUserMessage ("");
}

User avatar
andrew
Site Admin
Posts: 9059
Joined: Fri Mar 30, 2007 6:07 am

Re: Get the line number of an error

Post by andrew » Thu Dec 12, 2019 8:31 am

You could use multiple try / catch blocks to narrow down the location.

Or leave away the try / catch and let the script debugger tell you where the error is (start QCAD with -enable-script-debugger).

pietro_72_
Full Member
Posts: 81
Joined: Fri Apr 17, 2015 6:40 am
Location: http://creativitainformaticart.altervista.org

Re: Get the line number of an error

Post by pietro_72_ » Fri Dec 13, 2019 8:17 am

Thanks, I tried using .../qcadcam-3.20.1-pro-linux-x86_64/qcad" "-always-load-scripts" "-enable-script-debugger" "-rescan", but after the third continues the program turns off
Attachments
QCAD_debugger_Istantanea_2019-12-13_08-01-53.png
QCAD_debugger_Istantanea_2019-12-13_08-01-53.png (262.49 KiB) Viewed 3957 times

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”