Add try/catch to
This commit is contained in:
1 parent
a27cadc94f
commit
54fca685c0
1 file changed
+10
-4
@@ -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