@@ -3,7 +3,7 @@ const { addLog } = require("../models/logs");
3
3
const tasks = require ( "../models/tasks" ) ;
4
4
const { getUsername } = require ( "../utils/users" ) ;
5
5
const { EXTENSION_REQUEST_STATUS } = require ( "../constants/extensionRequests" ) ;
6
-
6
+ const { INTERNAL_SERVER_ERROR } = require ( "../constants/errorMessages" ) ;
7
7
/**
8
8
* Create ETA extension Request
9
9
*
@@ -66,7 +66,7 @@ const createTaskExtensionRequest = async (req, res) => {
66
66
} ) ;
67
67
} catch ( err ) {
68
68
logger . error ( `Error while creating new extension request: ${ err } ` ) ;
69
- return res . boom . badImplementation ( "An internal server error occurred" ) ;
69
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
70
70
}
71
71
} ;
72
72
@@ -87,7 +87,7 @@ const fetchExtensionRequests = async (req, res) => {
87
87
} ) ;
88
88
} catch ( err ) {
89
89
logger . error ( `Error while fetching Extension Requests ${ err } ` ) ;
90
- return res . boom . badImplementation ( "An internal server error occurred" ) ;
90
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
91
91
}
92
92
} ;
93
93
@@ -102,7 +102,7 @@ const getExtensionRequest = async (req, res) => {
102
102
extensionRequestData . id = extensionRequestId ;
103
103
return res . json ( { message : "Extension Requests returned successfully!" , extensionRequest : extensionRequestData } ) ;
104
104
} catch ( err ) {
105
- return res . boom . badImplementation ( "An internal server error occurred" ) ;
105
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
106
106
}
107
107
} ;
108
108
@@ -128,7 +128,7 @@ const getSelfExtensionRequests = async (req, res) => {
128
128
return res . boom . notFound ( "User doesn't exist" ) ;
129
129
} catch ( error ) {
130
130
logger . error ( `Error while fetching extension requests: ${ error } ` ) ;
131
- return res . boom . badImplementation ( "An internal server error occured" ) ;
131
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
132
132
}
133
133
} ;
134
134
@@ -156,7 +156,7 @@ const updateExtensionRequest = async (req, res) => {
156
156
return res . status ( 204 ) . send ( ) ;
157
157
} catch ( err ) {
158
158
logger . error ( `Error while updating extension request: ${ err } ` ) ;
159
- return res . boom . badImplementation ( "An internal server error occurred" ) ;
159
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
160
160
}
161
161
} ;
162
162
@@ -221,7 +221,7 @@ const updateExtensionRequestStatus = async (req, res) => {
221
221
return res . json ( { message : `Extension request ${ extensionStatus } succesfully` , extensionLog } ) ;
222
222
} catch ( err ) {
223
223
logger . error ( `Error while updating extension request: ${ err } ` ) ;
224
- return res . boom . badImplementation ( "An internal server error occurred" ) ;
224
+ return res . boom . badImplementation ( INTERNAL_SERVER_ERROR ) ;
225
225
}
226
226
} ;
227
227
0 commit comments