diff options
Diffstat (limited to 'app/Exceptions/Handler.js')
-rw-r--r-- | app/Exceptions/Handler.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/app/Exceptions/Handler.js b/app/Exceptions/Handler.js index efa2e0b..cb9e10b 100644 --- a/app/Exceptions/Handler.js +++ b/app/Exceptions/Handler.js | |||
@@ -1,6 +1,5 @@ | |||
1 | 'use strict' | ||
2 | 1 | ||
3 | const BaseExceptionHandler = use('BaseExceptionHandler') | 2 | const BaseExceptionHandler = use('BaseExceptionHandler'); |
4 | 3 | ||
5 | /** | 4 | /** |
6 | * This class handles all exceptions thrown during | 5 | * This class handles all exceptions thrown during |
@@ -20,14 +19,14 @@ class ExceptionHandler extends BaseExceptionHandler { | |||
20 | * | 19 | * |
21 | * @return {void} | 20 | * @return {void} |
22 | */ | 21 | */ |
23 | async handle (error, { request, response }) { | 22 | async handle(error, { response }) { |
24 | if (error.name === 'ValidationException') { | 23 | if (error.name === 'ValidationException') { |
25 | return response.status(400).send('Invalid arguments') | 24 | return response.status(400).send('Invalid arguments'); |
26 | } else if (error.name === 'InvalidSessionException') { | 25 | } if (error.name === 'InvalidSessionException') { |
27 | return response.status(401).redirect('/user/login'); | 26 | return response.status(401).redirect('/user/login'); |
28 | } | 27 | } |
29 | 28 | ||
30 | response.status(error.status).send(error.message) | 29 | return response.status(error.status).send(error.message); |
31 | } | 30 | } |
32 | 31 | ||
33 | /** | 32 | /** |
@@ -40,8 +39,9 @@ class ExceptionHandler extends BaseExceptionHandler { | |||
40 | * | 39 | * |
41 | * @return {void} | 40 | * @return {void} |
42 | */ | 41 | */ |
43 | async report (error, { request }) { | 42 | async report() { |
43 | return true; | ||
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
47 | module.exports = ExceptionHandler | 47 | module.exports = ExceptionHandler; |