Skip to content

Commit

Permalink
Fix chrome.runtime.lastError not working properly on Firefox (#593)
Browse files Browse the repository at this point in the history
  • Loading branch information
toasted-nutbread authored Jan 31, 2024
1 parent 38235b9 commit 8f48d40
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/js/extension/web-extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export class WebExtension extends EventDispatcher {
*/
getLastError() {
const {lastError} = chrome.runtime;
if (typeof lastError !== 'undefined') {
if (lastError) {
if (lastError instanceof Error) { return lastError; }
const {message} = lastError;
return new Error(typeof message === 'string' ? message : 'An unknown web extension error occured');
}
Expand Down

0 comments on commit 8f48d40

Please sign in to comment.