I thought if I throw an error from the getInputDat...
# suitescript
d
I thought if I throw an error from the getInputData stage of a Map/Reduce, I would immediately move to the summary stage and I can process the error in the summary.inputSummary.error property. I'm not seeing that behaviour. Is it just me?
s
what you’re thinking is correct. what is the behavior you’re seeing?
d
The documentation says the
f the error is thrown during the getInputData stage, the script goes immediately to the summarize stage, and the getInputData stage is not restarted
I'm throwing and error on purpose to test this ...
throw "I got and error here!";
In the summary, I've got if (summary.inputSummary.error) { log.error('test', summary.inputSummary.error); ]
I never get to the summary stage .. the Map/Reduce just errors out
So, it appears I need to include the config = { exitOnError: true }. Which is ass backwards
s
that should work with default config, at least mine does
exitOnError is for map/reduce stages. standard behavior is in case of an error on map/reduce stages, script goes to the next in the queue. if you enable exitOnError, script will not continue incase of an error
can you share your summary function?
r
you have an opening curly brace and a closing bracket ^^
d
Well, this requirement has me validating all data in the getInputData stage before proceeding to map/reduce. My design was to throw exceptions so I can unified my error handling in the summary stage. It appears that default config only works with map and reduce stages, when I introduced exitOnError: true, the getInputData worked as I wanted it