Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Unexpected error not getting caught in try/catch block
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> 0