I can throw errors in C++ code by pushing an error object and then calling duk_throw(). duk_pcall() returns with 'outcome != DUK_EXEC_SUCCESS' and I can examine the error object to determine, for example, the line number where the call to my API was. All working well, thank you.
If a script throws an error using EMCAscript throw( ), duk_pcall( ) returns 'outcome != DUK_EXEC_SUCCESS' as above but there is no error object on the stack. So I cannot determine the line number. Since the throw may be in scripts loaded with require() and not visible to the user, this is a pity.
Is it possible to get an error object from an ECMAscript throw( ) ?
Double check your finding. For me there's an error object on the TOS when
duk_pcallfails:And the error check is: