We have a cloud function which creates a Client object but sometimes it can fail so we have
try
{
/// here we try to create some Client object and it fails in beforeSave (we throw ‘some error’
}catch(error){
// here error isn’t just ‘some error’ but also
'Received an error with invalid JSON from Parse: Error: some error.< br > at error (/opt/server/node_modules/parse-server/lib/triggers.js:379:16) at process._tickCallback (internal/process/next_tick.js:68:7)
}
How to avoid that strange mix of html and our throw message, stripping it out manually sounds like a bit bad pattern. We want to get that throw message and pass it as a response to the client.
But even if I throw new Error it’s still wrapped in : Received an error with invalid JSON from Parse: Error: some new error .< br > at error (/opt/server/node_modules/parse-server/lib/triggers.js:379:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
I’m getting such errors in the client, maybe I should reconfigure something?
Another sample is for problems with login - on a web client (javascript Vue.js) I get such response, how can I even parse such a response? Maybe it’s something to do with express configuration?