From 94178df4d23e4e68acfdd23fe3d4c69393aef637 Mon Sep 17 00:00:00 2001 From: Michael Helvey Date: Sun, 30 Oct 2016 08:58:34 -0700 Subject: [PATCH] Add functionName to invalid function error (#2963) Currently in the logs if an invalid function is called the error message just says "invalid function" which is decidedly unhelpful when looking through server logs. Now it will say "Invalid function: "functionName"" --- spec/ParseAPI.spec.js | 2 +- src/Routers/FunctionsRouter.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ParseAPI.spec.js b/spec/ParseAPI.spec.js index 37655b28..be0fe5b2 100644 --- a/spec/ParseAPI.spec.js +++ b/spec/ParseAPI.spec.js @@ -1129,7 +1129,7 @@ it('ensure that if you try to sign up a user with a unique username and email, b done(); }, (e) => { expect(e.code).toEqual(Parse.Error.SCRIPT_FAILED); - expect(e.message).toEqual('Invalid function.'); + expect(e.message).toEqual('Invalid function: "somethingThatDoesDefinitelyNotExist"'); done(); }); }); diff --git a/src/Routers/FunctionsRouter.js b/src/Routers/FunctionsRouter.js index 3c208f6b..5a073d1b 100644 --- a/src/Routers/FunctionsRouter.js +++ b/src/Routers/FunctionsRouter.js @@ -161,7 +161,7 @@ export class FunctionsRouter extends PromiseRouter { theFunction(request, response); }); } else { - throw new Parse.Error(Parse.Error.SCRIPT_FAILED, 'Invalid function.'); + throw new Parse.Error(Parse.Error.SCRIPT_FAILED, `Invalid function: "${functionName}"`); } } }