Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors aren't instances of Error #257

Closed
fregante opened this issue Jan 23, 2021 · 2 comments · Fixed by #293 · May be fixed by ramzimalhas/refined-zapier#2
Closed

Errors aren't instances of Error #257

fregante opened this issue Jan 23, 2021 · 2 comments · Fixed by #293 · May be fixed by ramzimalhas/refined-zapier#2

Comments

@fregante
Copy link
Contributor

Run this in background.js:

browser.permissions.request({origins:["<all_urls>"]})
	.catch(err => console.log(err instanceof Error, err))

Firefox:

true

Chrome:

false

Source:

if (extensionAPIs.runtime.lastError) {
promise.reject(extensionAPIs.runtime.lastError);

Suggested code:

        if (extensionAPIs.runtime.lastError) {
          promise.reject(new Error(extensionAPIs.runtime.lastError.message));
@Rob--W
Copy link
Member

Rob--W commented Jan 23, 2021

Why would you want an Error instance here? It would be rather meaningless (stack, type doesn't add value).

@fregante
Copy link
Contributor Author

Specifically i found out about this because I was using alert(error), which printed a nice 'Error: blah blah' in Firefox but '[object Object]' in Chrome. Additionally I was under the impression that polyfills are meant to standardize a set of APIs, so if something works on Firefox it should work the same in Chrome too, unless impossible (like the stack part)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants