Fix backend handling errors incorrectly

This commit is contained in:
toasted-nutbread 2019-10-13 16:06:19 -04:00
parent f3ab7673f9
commit f8e666b70c

View File

@ -73,9 +73,10 @@ class Backend {
if (handlers.hasOwnProperty(action)) {
const handler = handlers[action];
const promise = handler(params, sender);
promise
.then(result => callback({result}))
.catch(error => callback(errorToJson(error)));
promise.then(
result => callback({result}),
error => callback({error: errorToJson(error)})
);
}
return true;