Handle errors during "fetch" action (#44)
This commit is contained in:
@@ -333,12 +333,21 @@ async function handleMessage(settings, message, sendResponse) {
|
||||
// check that action is present
|
||||
if (typeof message !== "object" || !message.hasOwnProperty("action")) {
|
||||
sendResponse({ status: "error", message: "Action is missing" });
|
||||
return;
|
||||
}
|
||||
|
||||
// fetch file & parse fields if a login entry is present
|
||||
try {
|
||||
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
|
||||
switch (message.action) {
|
||||
|
Reference in New Issue
Block a user