diff options
Diffstat (limited to 'src/server/app/Exceptions/Handler.js')
-rw-r--r-- | src/server/app/Exceptions/Handler.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/server/app/Exceptions/Handler.js b/src/server/app/Exceptions/Handler.js deleted file mode 100644 index e8d2d2ee2..000000000 --- a/src/server/app/Exceptions/Handler.js +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | |||
2 | const BaseExceptionHandler = use('BaseExceptionHandler'); | ||
3 | |||
4 | /** | ||
5 | * This class handles all exceptions thrown during | ||
6 | * the HTTP request lifecycle. | ||
7 | * | ||
8 | * @class ExceptionHandler | ||
9 | */ | ||
10 | class ExceptionHandler extends BaseExceptionHandler { | ||
11 | /** | ||
12 | * Handle exception thrown during the HTTP lifecycle | ||
13 | * | ||
14 | * @method handle | ||
15 | * | ||
16 | * @param {Object} error | ||
17 | * @param {Object} options.request | ||
18 | * @param {Object} options.response | ||
19 | * | ||
20 | * @return {void} | ||
21 | */ | ||
22 | async handle(error, { response }) { | ||
23 | if (error.name === 'ValidationException') { | ||
24 | return response.status(400).send('Invalid arguments'); | ||
25 | } | ||
26 | |||
27 | return response.status(error.status).send(error.message); | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * Report exception for logging or debugging. | ||
32 | * | ||
33 | * @method report | ||
34 | * | ||
35 | * @param {Object} error | ||
36 | * @param {Object} options.request | ||
37 | * | ||
38 | * @return {void} | ||
39 | */ | ||
40 | async report() { | ||
41 | return true; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | module.exports = ExceptionHandler; | ||