aboutsummaryrefslogtreecommitdiffstats
path: root/app/Exceptions
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-09-05 11:22:49 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-09-05 11:22:49 +0200
commit29b8334b060dc0c05a509d523ead4b3a30229fef (patch)
tree4dbfcfb90a3eff31acd219b27557bbdc594f589f /app/Exceptions
parentAdd cookie notice to login page (diff)
downloadferdium-server-29b8334b060dc0c05a509d523ead4b3a30229fef.tar.gz
ferdium-server-29b8334b060dc0c05a509d523ead4b3a30229fef.tar.zst
ferdium-server-29b8334b060dc0c05a509d523ead4b3a30229fef.zip
Add eslint
Diffstat (limited to 'app/Exceptions')
-rw-r--r--app/Exceptions/Handler.js16
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
3const BaseExceptionHandler = use('BaseExceptionHandler') 2const 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
47module.exports = ExceptionHandler 47module.exports = ExceptionHandler;