diff --git a/src/Routers/FunctionsRouter.js b/src/Routers/FunctionsRouter.js index 550b04945a..e40ede0502 100644 --- a/src/Routers/FunctionsRouter.js +++ b/src/Routers/FunctionsRouter.js @@ -119,10 +119,14 @@ export class FunctionsRouter extends PromiseRouter { if (typeof message === 'string') { return reject(new Parse.Error(code, message)); } + const error = new Parse.Error( + code, + (message && message.message) || message + ); if (message instanceof Error) { - message = message.message; + error.stack = message.stack; } - reject(new Parse.Error(code, message)); + reject(error); }, message: message, };