-
Notifications
You must be signed in to change notification settings - Fork 5k
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
obs-store/local-store should upgrade webextension error to real error #7207
Conversation
Builds ready [f6e4b54]
|
function checkForError () { | ||
const lastError = extension.runtime.lastError | ||
if (!lastError) return | ||
return new Error(lastError.message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should check whether it's already an error first, before extracting the message to construct a new error?
I haven't tested this on Firefox, but MDN does claim that runtime.lastError
is an Error object. So maybe an instanceof Error
check would catch that case, preserving any other metadata that error might have (like a stack trace).
Great find! It's always frustrating to see Sentry errors that are plain text, and those empty object errors are even worse. I was wondering why that was happening. |
Builds ready [ab4be0f]
|
* origin/develop: (56 commits) Add advanced setting to enable editing nonce on confirmation screens (MetaMask#7089) Add migration on 3box imports and remove feature flag (MetaMask#7209) ci - install deps - limit install scripts to whitelist (MetaMask#7208) Add a/b test for full screen transaction confirmations (MetaMask#7162) Update minimum Firefox verison to 56.0 (MetaMask#7213) mesh-testing - submit infura rpc requests to mesh-testing container (MetaMask#7031) obs-store/local-store should upgrade webextension error to real error (MetaMask#7207) sesify-viz - bump dep for visualization enhancement (MetaMask#7175) address book entries by chainId (MetaMask#7205) Optimize images only during production build (MetaMask#7194) Use common test build during CI (MetaMask#7196) Report missing `en` locale messages to Sentry (MetaMask#7197) Verify locales on CI (MetaMask#7199) updated ganache and addons-linter (MetaMask#7204) fixup! add user rejected errors add user rejected errors update json-rpc-engine use eth-json-rpc-errors Remove unused locale messages (MetaMask#7190) Remove unused components (MetaMask#7191) ...
the error (in chromium at least) is an object with a non-enumerable getter for message, so it serializes itself as an empty object. This ensures the error is a proper error object which may improve reporting to sentry