From 86015dba9742c1bfeccd508a8f38385ddd3480c4 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Thu, 28 May 2015 14:52:17 +0200 Subject: [PATCH] Added 404 response to PUT/PATCH/GET templates. --- .../org/arangodb/foxx/templates/controller.js.tmpl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/server/modules/org/arangodb/foxx/templates/controller.js.tmpl b/js/server/modules/org/arangodb/foxx/templates/controller.js.tmpl index 6aeec2341a..66fb68666f 100644 --- a/js/server/modules/org/arangodb/foxx/templates/controller.js.tmpl +++ b/js/server/modules/org/arangodb/foxx/templates/controller.js.tmpl @@ -49,7 +49,8 @@ controller.get('/:id', function (req, res) { var id = req.urlParameters.id; res.json(<%= repositoryInstance %>.byId(id).forClient()); }) -.pathParam('id', <%= modelInstance %>IdSchema); +.pathParam('id', <%= modelInstance %>IdSchema) +.errorResponse(ArangoError, 404, 'The <%= modelInstance %> could not be found'); /** Replaces a <%= modelInstance %> * @@ -65,7 +66,8 @@ controller.put('/:id', function (req, res) { .bodyParam('<%= modelInstance %>', { description: 'The <%= modelInstance %> you want your old one to be replaced with', type: <%= model %> -}); +}) +.errorResponse(ArangoError, 404, 'The <%= modelInstance %> could not be found'); /** Updates a <%= modelInstance %> * @@ -81,7 +83,8 @@ controller.patch('/:id', function (req, res) { .bodyParam('patch', { description: 'The patch data you want your <%= modelInstance %> to be updated with', type: joi.object().required() -}); +}) +.errorResponse(ArangoError, 404, 'The <%= modelInstance %> could not be found'); /** Removes a <%= modelInstance %> *