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

Fixed error messages being wrapped in strings when using ganache or h… #15205

Closed
wants to merge 5 commits into from

Conversation

BelfordZ
Copy link
Contributor

@BelfordZ BelfordZ commented Jul 13, 2022

Note: Developers might have code that is similarily parsing out the underlying error in a similar way. This PR improves the returned errors, and breaks peoples code for handling the nested-in-a-string errors.

This was the only place I could find inside of extension that is handling errors that are returned in-band when calling sendtransactionRaw to ganache or harthat.

Fixes #12646

Before:
image
After:
image

Before:
image
After:
image

@BelfordZ BelfordZ requested a review from a team as a code owner July 13, 2022 02:10
@BelfordZ BelfordZ requested a review from garrettbear July 13, 2022 02:10
@github-actions
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@BelfordZ BelfordZ force-pushed the fix/mangle-errors-from-ethjs branch from c4e9616 to 953e081 Compare July 13, 2022 02:31
@BelfordZ BelfordZ force-pushed the fix/mangle-errors-from-ethjs branch from 953e081 to cf41946 Compare July 13, 2022 19:41
@BelfordZ BelfordZ force-pushed the fix/mangle-errors-from-ethjs branch from e35c57c to 7d57d06 Compare July 13, 2022 20:06
@metamaskbot
Copy link
Collaborator

Builds ready [7d57d06]
Page Load Metrics (1710 ± 52 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint90158109178
domContentLoaded1553190416989445
load15531985171010952
domInteractive1553190416989445

@wbt
Copy link
Contributor

wbt commented Jul 26, 2022

Having just today written even more code that parses out nested-in-string errors (lacking any other way to get the information) I am not a fan of the idea of just breaking this suddenly....there is a lot of DApp code with workarounds for this longstanding issue that will probably break.
Could this be done in a nonbreaking way, keeping content nested in the string in addition to in a more easily parseable format, plus a communications strategy to get the word out so people can start converting their code over, before some eventual breaking of lots of existing Dapp code?

@BelfordZ
Copy link
Contributor Author

BelfordZ commented Jul 29, 2022

@wbt understandable and agreed. Closing this PR since the plan has changed:

  1. We will address this inside of ethjs-query.
  2. We wont change the error message or code, we will add a data field with the parsed json part of the current error.message.

In doing so, users who haven't yet written the code to parse out the underyling error will at least have the error.data which will contain what they really are after, and those who've already written code against these error messages don't get punished.

We should leave it like this until we have a well-defined process for incurring 'breaking for the better' changes (thx for the comment @wbt). There are some other fixes that have been held back for the same reason, so it's becoming a greater and greater priority to stamp out a process around the lifecycle of a breaking change to metamask public api. Developers should be given incrementally louder signals about upcoming changes so that they have a predictable and ample amount of time to update their code. We want to make sure we get that part right :)

@BelfordZ BelfordZ closed this Jul 29, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jul 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error from contract returned as string not as object
3 participants