From d7b18776f1610e8ffcc48a1536e3a623f89328d9 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 21 Aug 2016 17:55:26 +0200 Subject: [PATCH] Improved error response in edit tag request --- module/Rest/src/Action/EditTagsAction.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/Rest/src/Action/EditTagsAction.php b/module/Rest/src/Action/EditTagsAction.php index 680980ed..3dd76333 100644 --- a/module/Rest/src/Action/EditTagsAction.php +++ b/module/Rest/src/Action/EditTagsAction.php @@ -64,7 +64,10 @@ class EditTagsAction extends AbstractRestAction $shortUrl = $this->shortUrlService->setTagsByShortCode($shortCode, $tags); return new JsonResponse(['tags' => $shortUrl->getTags()->toArray()]); } catch (InvalidShortCodeException $e) { - return $out($request, $response->withStatus(404), 'Not found'); + return new JsonResponse([ + 'error' => RestUtils::getRestErrorCodeFromException($e), + 'message' => sprintf($this->translator->translate('No URL found for short code "%s"'), $shortCode), + ], 404); } } }