mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-17 07:10:08 -06:00
Add try/catch to
This commit is contained in:
@@ -39,9 +39,15 @@ const getStatusPageByUrl = async (url) => {
|
||||
};
|
||||
|
||||
const urlIsUnique = async (url) => {
|
||||
const statusPage = await StatusPage.find({ url });
|
||||
if (statusPage.length > 0) return false;
|
||||
return true;
|
||||
try {
|
||||
const statusPage = await StatusPage.find({ url });
|
||||
if (statusPage.length > 0) return false;
|
||||
return true;
|
||||
} catch (error) {
|
||||
error.service = SERVICE_NAME;
|
||||
error.method = "urlIsUnique";
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export { createStatusPage, getStatusPageByUrl };
|
||||
export { createStatusPage, getStatusPageByUrl, urlIsUnique };
|
||||
|
||||
Reference in New Issue
Block a user