Refactored hardcoded error messages to util file. Added logging to job queue
This commit is contained in:
1 parent
1ad32ed84b
commit
5da22f4403
10 files changed
+138
-60
No files matched your search
@@ -6,6 +6,7 @@ const errorMessages = {
|
||||
UNAUTHORIZED: "Unauthorized access",
|
||||
|
||||
//Error handling middleware
|
||||
UNKNOWN_SERVICE: "Unknown service",
|
||||
NO_AUTH_TOKEN: "No auth token provided",
|
||||
INVALID_AUTH_TOKEN: "Invalid auth token",
|
||||
|
||||
@@ -14,6 +15,7 @@ const errorMessages = {
|
||||
VERIFY_OWNER_UNAUTHORIZED: "Unauthorized access",
|
||||
|
||||
//DB Errors
|
||||
DB_USER_EXISTS: "User already exists",
|
||||
DB_USER_NOT_FOUND: "User not found",
|
||||
DB_TOKEN_NOT_FOUND: "Token not found",
|
||||
DB_RESET_PASSWORD_BAD_MATCH:
|
||||
@@ -23,12 +25,24 @@ const errorMessages = {
|
||||
DB_DELETE_CHECKS: (monitorId) =>
|
||||
`No checks found for monitor with id ${monitorId}`,
|
||||
DB_DELETE_ALERT: (alertId) => `Alert with id ${alertId} not found`,
|
||||
|
||||
//Auth errors
|
||||
AUTH_INCORRECT_PASSWORD: "Incorrect password",
|
||||
AUTH_UNAUTHORIZED: "Unauthorized access",
|
||||
|
||||
// Monitor Errros
|
||||
MONITOR_GET_BY_ID: "Monitor not found",
|
||||
MONITOR_GET_BY_USER_ID: "No monitors found for user",
|
||||
|
||||
// Job Queue Errors
|
||||
JOB_QUEUE_WORKER_CLOSE: "Error closing worker",
|
||||
JOB_QUEUE_DELETE_JOB: "Job not found in queue",
|
||||
};
|
||||
|
||||
const successMessages = {
|
||||
//Alert Controller
|
||||
ALERT_CREATE: "Alert created successfully",
|
||||
ALERT_GET: "Got alerts successfully",
|
||||
ALERT_GET_BY_USER: "Got alerts successfully",
|
||||
ALERT_GET_BY_MONITOR: "Got alerts by Monitor successfully",
|
||||
ALERT_GET_BY_ID: "Got alert by Id successfully",
|
||||
ALERT_EDIT: "Alert edited successfully",
|
||||
@@ -50,8 +64,17 @@ const successMessages = {
|
||||
//Monitor Controller
|
||||
MONITOR_GET_ALL: "Got all monitors successfully",
|
||||
MONTIOR_GET_BY_ID: "Got monitor by Id successfully",
|
||||
MONITOR_GET_BY_USERID: "Got monitor by UserId successfully",
|
||||
MONITOR_GET_BY_USER_ID: (userId) => `Got monitor for ${userId} successfully"`,
|
||||
MONITOR_CREATE: "Monitor created successfully",
|
||||
MONITOR_DELETE: "Monitor deleted successfully",
|
||||
MONITOR_EDIT: "Monitor edited successfully",
|
||||
|
||||
//Job Queue
|
||||
JOB_QUEUE_DELETE_JOB: "Job removed successfully",
|
||||
JOB_QUEUE_OBLITERATE: "Queue OBLITERATED!!!",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
errorMessages,
|
||||
successMessages,
|
||||
};
|
||||
Reference in new issue
Block a user