mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-15 06:09:44 -06:00
Add service name and method name to errors in recovery module
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const Notification = require("../../../models/Notification");
|
||||
|
||||
const SERVICE_NAME = "notificationModule";
|
||||
/**
|
||||
* Creates a new notification.
|
||||
* @param {Object} notificationData - The data for the new notification.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const PageSpeedCheck = require("../../../models/PageSpeedCheck");
|
||||
|
||||
const SERVICE_NAME = "pageSpeedCheckModule";
|
||||
/**
|
||||
* Create a PageSpeed check for a monitor
|
||||
* @async
|
||||
|
||||
@@ -2,6 +2,7 @@ const UserModel = require("../../../models/user");
|
||||
const RecoveryToken = require("../../../models/RecoveryToken");
|
||||
const crypto = require("crypto");
|
||||
const { errorMessages } = require("../../../utils/messages");
|
||||
const SERVICE_NAME = "recoveryModule";
|
||||
|
||||
/**
|
||||
* Request a recovery token
|
||||
@@ -22,6 +23,8 @@ const requestRecoveryToken = async (req, res) => {
|
||||
await recoveryToken.save();
|
||||
return recoveryToken;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "requestRecoveryToken";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -38,6 +41,8 @@ const validateRecoveryToken = async (req, res) => {
|
||||
throw new Error(errorMessages.DB_TOKEN_NOT_FOUND);
|
||||
}
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "validateRecoveryToken";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -70,6 +75,8 @@ const resetPassword = async (req, res) => {
|
||||
throw new Error(errorMessages.DB_USER_NOT_FOUND);
|
||||
}
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "resetPassword";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user