question

Stephane R avatar image
0 Likes"
Stephane R asked Phil BoBo edited

How to simply identify a line throwing an exception?

I found that awesome post from 2017: https://answers.flexsim.com/idea/45154/proper-exception-handling-in-flexscript.html

I'm new to FlexSim, but not to coding. This is exactly the struggle I have today. Stepping line by line is good advice, unless the function is recursive, and the exception happens deep inside.

Has anything been improved in FlexSim between 2017-2019, to enable breakpoints on exceptions, exception catching in code, or just more precise context/display of the line throwing the exception ?

FlexSim 19.0.6
flexscriptdebuggingexceptions
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Phil BoBo avatar image
2 Likes"
Phil BoBo answered Phil BoBo edited

Nothing has changed with regards to FlexScript exception handling since that card was created.

If step-debugging isn't working well for you, you could try using mpt() commands to print to the System Console to help narrow down the source of the exception.

For the most part, the exception handling mechanism that FlexScript already uses, which catches exceptions and prints the details to the System Console, works well for debugging these types of errors. If a specific case isn't giving useful information, you could create an example of the error situation and email it to [email protected] for us to attempt to improve the error message to make it easier to find and fix that type of error in future versions.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.