How can I avoid netsuite displaying a stack trace ...
# suitescript
a
How can I avoid netsuite displaying a stack trace while throwing an error created with N/error?
s
catch the error and manipulate as desired?
a
I need to prevent the record from being submitted.
At all costs.
s
I assume @stalbert meant catching the error, then modifying it to remove the stacktrace ( setting it to null, etc. ) then re-throwing the modified error. If that doesn’t work (the stacktrace can’t be modified or removed), then just create and throw a new custom error yourself.
a
Ah now I get it.
s
Yes, if you can provide a more meaningful error message for the users that will be much better than the default NS serialization of an error object with the stack trace and other garbage to confuse an end user.