Handle errors during "fetch" action (#44)
This commit is contained in:
@@ -333,11 +333,20 @@ async function handleMessage(settings, message, sendResponse) {
|
|||||||
// check that action is present
|
// check that action is present
|
||||||
if (typeof message !== "object" || !message.hasOwnProperty("action")) {
|
if (typeof message !== "object" || !message.hasOwnProperty("action")) {
|
||||||
sendResponse({ status: "error", message: "Action is missing" });
|
sendResponse({ status: "error", message: "Action is missing" });
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetch file & parse fields if a login entry is present
|
// fetch file & parse fields if a login entry is present
|
||||||
if (typeof message.login !== "undefined") {
|
try {
|
||||||
await parseFields(settings, message.login);
|
if (typeof message.login !== "undefined") {
|
||||||
|
await parseFields(settings, message.login);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
sendResponse({
|
||||||
|
status: "error",
|
||||||
|
message: "Unable to fetch and parse login fields: " + e.toString()
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// route action
|
// route action
|
||||||
|
Reference in New Issue
Block a user