If I were using a resource block, with “continue on error”, and an error occurred, I would have some error information available in a downstream javascript block. How can I get that same error information, when using a single-step resource function, called from javascript?
If wired up as above,
callGetCaseWrapper.error will be
{
error: 'Error: \n' +"WHERE Id = 'abc123'\n" +' ^\n' +'ERROR at Row:3:Column:7\n' +'invalid ID field: abc123 (line 1)',
data: null,
value: null,
metadata: null,
loggingMetadata: undefined
}
if callGetCaseWrapper is wired up directly to getCase, code1 will log the full error object I would expected
callGetCaseWrapper.error will be
{
statusCode: 400,
error: 'Bad Request',
message: '\n' +"WHERE Id = 'abc123'\n" +' ^\n' +'ERROR at Row:3:Column:7\n' +'invalid ID field: abc123',
data: null
}
To be explicit, I am asking for 2 things here.
callGetCaseWrappercallsgetCaseWrapperwhich in turn callsgetCaseWrapper. As the screenshot above shows, there is no try/catch around the call togetCase. Therefore, the exception that is effectively raised bygetCaseshould be passed through, and not mangled with.- If I were to modify
getCaseWrapperand wrapgetCasein a try/catch, when an error occurs, I would like to gain access to the same error as ifgetCasewere called outside of javascript.
And then, a big
on top – it would be outstanding if I could establish the shape of the error object from a javascript block. Example below.
const myError = new Error("Something is messed up.");
myError.statusCode: 422;
myError.error = 'You provided an invalid value for xyz';
myError.message = 'blah';
raise myError;

