Skip to content

feat: add generic msg on failed transactions #587

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Jonatan-Chaverri
Copy link

Task name here

Fixes #573

Types of change

  • Feature
  • Bug
  • Enhancement

Comments (optional)

@metalboyrick metalboyrick changed the base branch from main to develop July 1, 2025 03:36
Copy link
Collaborator

@metalboyrick metalboyrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GM @Jonatan-Chaverri , thanks for your PR! You got the idea right. Leaving some comments and thoughts for improvement

  1. Can we improve the style? (fix the padding and margins)

image

  1. Can we have a clickable link that points us to the specific log from the toast? so that it is easier to trace the error logs for other developers

  2. Can we extract some common errors like insufficient balance or approval required? We can discuss this further if you think this is possible / not possible

@metalboyrick
Copy link
Collaborator

GM @Jonatan-Chaverri, any updates on this?

@Jonatan-Chaverri
Copy link
Author

@metalboyrick I will work on this today and provide an update at the EOD

@Jonatan-Chaverri Jonatan-Chaverri force-pushed the better_error_msg_handling branch from c187bc3 to b7e8824 Compare July 2, 2025 20:27
@Jonatan-Chaverri
Copy link
Author

@metalboyrick I have addressed the first two requests.

For the third, we can have a file similar to this
https://github.com/starknet-io/types-js/blob/main/src/api/errors.ts#L107

and translate each code to a more verbose error message, is that what you mean? if not, please elaborate a little more. Thanks.

@Jonatan-Chaverri Jonatan-Chaverri force-pushed the better_error_msg_handling branch 2 times, most recently from 4a36e4e to 82646cc Compare July 2, 2025 21:29
@metalboyrick
Copy link
Collaborator

@Jonatan-Chaverri Yeah something like that would be great, because it gives better clarity to users rather than some strange JSON. You can try out some common ones like insufficient balance, no approval. (be mindful of which errors are common which errors can be user-specific)

@Jonatan-Chaverri Jonatan-Chaverri force-pushed the better_error_msg_handling branch 2 times, most recently from 1bf9c79 to d85efc2 Compare July 4, 2025 00:14
@Jonatan-Chaverri
Copy link
Author

@metalboyrick I updated the PR, let me know your thoughts, thanks.

Copy link
Collaborator

@metalboyrick metalboyrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

Can fix the styling ser, please make sure the margins and paddings are not too wide, we do not need the dark background as well.

image

Also, I did not see the common error po up when transferring insufficient balance

image

@Jonatan-Chaverri Jonatan-Chaverri force-pushed the better_error_msg_handling branch from d85efc2 to 4b28de7 Compare July 4, 2025 20:53
@Jonatan-Chaverri
Copy link
Author

@metalboyrick ok, made some changes to fix the margins, this is how it looks now
Screenshot 2025-07-04 at 2 50 45 PM

Also, I tried getting insufficient balance error to test too and this is the error content my function is getting
Screenshot 2025-07-04 at 2 48 22 PM

TypeError: Failed to fetch does not match any known common error so that's why it is not showing in the toast.

I'm not aware of how all starknet common errors are printed, so the file I created is based on assumptions that at least keywords will appear in the error, but again is not 100% reliable until we can confirm that (or if you know how to confirm error messages, you can point me to it and I will update)

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

Successfully merging this pull request may close these issues.

Better Error Message Handling on Failed Transactions
2 participants