Add service name and method name to errors in maintenanceController

This commit is contained in:
Alex Holliday committed 2024-09-15 12:13:05 +08:00
1 parent de1bcd20be
commit 185751b6b6
1 file changed
+12 -3
@@ -39,7 +39,10 @@ const createMaintenanceWindow = async (req, res, next) => {
data: maintenanceWindow,
});
} catch (error) {
error.service = SERVICE_NAME;
error.service === undefined ? (error.service = SERVICE_NAME) : null;
error.method === undefined
? (error.method = "createMaintenanceWindow")
: null;
next(error);
}
};
@@ -68,7 +71,10 @@ const getMaintenanceWindowsByUserId = async (req, res, next) => {
data: maintenanceWindows,
});
} catch (error) {
error.service = SERVICE_NAME;
error.service === undefined ? (error.service = SERVICE_NAME) : null;
error.method === undefined
? (error.method = "getMaintenanceWindowsByUserId")
: null;
next(error);
}
};
@@ -98,7 +104,10 @@ const getMaintenanceWindowsByMonitorId = async (req, res, next) => {
data: maintenanceWindows,
});
} catch (error) {
error.service = SERVICE_NAME;
error.service === undefined ? (error.service = SERVICE_NAME) : null;
error.method === undefined
? (error.method = "getMaintenanceWindowsByMonitorId")
: null;
next(error);
}
};