Each `map()` and `reduce()` is essentially indepen...
# suitescript
p
Each
map()
and
reduce()
is essentially independent of the others too, right? So an error thrown in one wouldn't stop everything would it?
d
ITs independent but its in same thread. If an error is not solved, all thread is die
👍 1
e
An error on a single invocation of
map
or
reduce
will only stop that specific invocation. That same processor (thread) will continue to process further iterations of
map
or
reduce
e.g. If you are only using one Processor for your script, and an error occurs on invocation #10 of
map
, #11 will still continue in due course
You can optionally set the
exitOnError
setting if you do want the first error encountered to completely halt the script. See
Help:Configuration Options for Handling Map/Reduce Interruptions
p
I definitely don't want to stop the whole script on a single error. Problem is, I don't even know if an error is causing it to stop at all
s
you should log errors in the summary stage
👍 1
I think some errors will appear there that are not catch-able
e
@Perry Auld add a try/catch in all your stages, input, map, reduce, summary to catch the error, by default is an error happens if a map stage, nothing is displaying on the logs, you must do it
👍 1
d
@Perry Auld, those functions can help you in stages and do not break your thread.
p
@Diego Modesto do you have those functions just log individual errors, or try to accumulate them & log once?
d
accumulate, I does not use to log once cause this schedule I use one time per day
handleErrorIfAny's function is called in Summarize, but you can use in MAP or REDUCE
e
For exactly this reason, I've recently added this function to my Map/Reduce template: