javascript - How to show the custom error message without stack trace using suitescript 2.0 in netsuite -


i want show custom error message out stack trace user using "suitescript 2.0"version. in workflow custom error message showing without stack trace in suite script "error message " showing stack trace.

error stack trace: {"type":"error.suitescripterror","name":"missing_contract_line","message":"please enter atleast 1 contract line item save contract.","stack":["createerror(n/error)","beforesubmit(suitescripts/ex_ue_contract_2.0.js:117)","createerror(n/error)"],"cause":{"name":"missing_contract_line","message":"please enter atleast 1 contract line item save contract."},"id":""}

i want show custom error message without stack trace this: "name":"missing_contract_line","message":"please enter atleast 1 contract line item save contract."

my code:

     throw error.create({          name: 'missing_contract_line',          message: 'please enter atleast 1 contract line item save contract.'      }); 

is there possible way achieve this?

thanks in advance.

the default implementation of n/error's suitescripterror#tostring() method call json.stringify(this), however, method overridden per instance handle cases raw error message intended displayed users via throwing error out of script. example:

var err = error.create({name: 'no_json', message: 'this should not displayed json!'}) err.tostring = function(){return err.message}; throw err; 

alternatively, possible throw string, however, intervening catch blocks lose benefit of accessing other properties of error, example, error#stack or error#name.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -