Page 2 of 2

Re: Error info about try/catch

Posted: Sat May 27, 2023 6:08 pm
by jacque
I'm not sure why it's omitted in standalones, so I'm confused too. Especially since the error codes are duplicated in the revErrorDisplay stack. I haven't looked but it's possible that scriptExecutionErrors contains IDE errors that wouldn't apply to standalones.

Re: Error info about try/catch

Posted: Sat May 27, 2023 6:46 pm
by mwieder
If you include the revErrorReport stack in your standalone then you do have access to the list, but you have to grab it yourself.
In the script for revSaveAsStandalone.livecodescript I see

Code: Select all

      set the cErrorsList of stack "revErrorReport" to the scriptExecutionErrors
      set the cScriptErrors of stack "revErrorReport" to the scriptParsingErrors
so in your standalone app you could

Code: Select all

get line pErrorNum of the cErrorsList of stack "revErrorDisplay" 
Edited... Nope. That doesn't work. Standalone apps are explicitly banned from displaying error strings.
In mode_standalone.cpp I find

Code: Select all

// We don't include error string in this mode
const char *MCparsingerrors = "";
const char *MCexecutionerrors = "";
So the only way I've found to have the error strings in a standalone app is to set a custom property and then use that:
From the message box before building the standalone:

Code: Select all

set the uScriptExecutionErrors of stack <mainstack> to the scriptExecutionErrors
and then in the standalone's error handling code

Code: Select all

get line pErrorNum of the uScriptExecutionErrors of this stack

Re: Error info about try/catch

Posted: Sat May 27, 2023 8:45 pm
by FourthWorld
Remember when IDE-specific handlers had a prefix which allowed is to identify them as such?

This confusion about error string availability is another example of why that was useful.

Re: Error info about try/catch

Posted: Sat May 27, 2023 9:04 pm
by mwieder
Maybe. But it's not a handler, it's a system property.

Re: Error info about try/catch

Posted: Sun May 28, 2023 2:00 am
by FourthWorld
mwieder wrote: Sat May 27, 2023 9:04 pm Maybe. But it's not a handler, it's a system property.
All the weirder, a system property unavailable to standalones built with the system.

Re: Error info about try/catch

Posted: Sun May 28, 2023 7:42 pm
by mwieder

Re: Error info about try/catch

Posted: Sun May 28, 2023 8:17 pm
by stam
Sadly looks like it was hibernated 6 years ago…