I am trying to catch an unexpected error in a try/catch block. nlobjError objects are caught and handled successfully, however for some reason system errors skip my error handling.
A quick test:
<span style="color:'#000080'"><strong>try </strong></span>{ <em> nlapiLogExecution</em>(<span style="color:'#008000'"><strong>'debug'</strong></span>,<span style="color:'#008000'"><strong>'started test'</strong></span>; //note that we're missing a paren. This is intentional. } <span style="color:'#000080'"><strong>catch</strong></span>(e) { <span style="color:'#000080'"><strong>if</strong></span>(e <span style="color:'#000080'"><strong>instanceof </strong></span><em>nlobjError</em>) { <em>nlapiLogExecution</em>(<span style="color:'#008000'"><strong>'debug'</strong></span>,<span style="color:'#008000'"><strong>'nlobjError')</strong></span>; } <span style="color:'#000080'"><strong>else </strong></span>{ nlapiLogExecution('debug', 'error filename returned is'); } <span style="color:'#252C2F'"><span style="font-family:'Helvetica'"><span style="font-size:'13px'">}</span></span></span> Unfortunately the catch block never hits - I get no data in logged except the system message: [RIGHT][COLOR=#777777 !important]TITLE[/COLOR][/RIGHT] UNEXPECTED_ERROR |
[RIGHT][COLOR=#777777 !important]TYPE[/COLOR][/RIGHT] System |
[RIGHT][COLOR=#777777 !important]DATE & TIME[/COLOR][/RIGHT] 1/7/2015 2:59 pm |
[RIGHT][COLOR=#777777 !important]DETAILS[/COLOR][/RIGHT] missing ) after argument list (getCustomer.js$3747074#22) |
I am expecting to see "error filename returned is" but that never appears.How can I catch system errors?