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

Improve error handling #210

Merged
merged 9 commits into from
Oct 16, 2023
Merged

Improve error handling #210

merged 9 commits into from
Oct 16, 2023

Conversation

jubalm
Copy link
Collaborator

@jubalm jubalm commented Oct 6, 2023

Improve error handling, adding proper notices and error messages on transfer:

  • user rejection as a quick toast message instead of error
  • handle RPC errors unbeknownst to ethersjs
  • refactor ethereum provider details, moving it to Ethereum context
  • refactor account details, moving it to Wallet context
  • remove unused files and functions

Notable UI update:

Screenshot 2023-10-10 at 4 00 20 PM

Resolves #138

@netlify
Copy link

netlify bot commented Oct 6, 2023

Deploy Preview for thunderous-smakager-9b6002 ready!

Name Link
🔨 Latest commit a2f8e77
🔍 Latest deploy log https://app.netlify.com/sites/thunderous-smakager-9b6002/deploys/652cdb0c521b7f0008a8ba06
😎 Deploy Preview https://deploy-preview-210--thunderous-smakager-9b6002.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jubalm jubalm force-pushed the feature/improved-error-handling branch 2 times, most recently from 3bd4f59 to 5b9960a Compare October 9, 2023 16:46
@jubalm jubalm force-pushed the feature/improved-error-handling branch from 5b9960a to f2407ad Compare October 10, 2023 07:59
@jubalm jubalm marked this pull request as ready for review October 11, 2023 08:53
@jubalm jubalm force-pushed the feature/improved-error-handling branch from 72ed394 to 345a3b0 Compare October 12, 2023 10:28
@jubalm jubalm force-pushed the feature/improved-error-handling branch from 345a3b0 to 88831ca Compare October 12, 2023 10:30
@jubalm jubalm requested review from KillariDev and 0xjimmy October 12, 2023 10:31
app/ts/components/TokenPicker.tsx Outdated Show resolved Hide resolved
Comment on lines 157 to 159
// TODO: implement amount query
console.log('token amount', receipt, addFavoriteStore)
return <></>
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel this should be done before this is merged?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated the current PR to include the changes

waitFor(async () => {
const signer = await browserProvider.getSigner()
if (!browserProvider.value) {
throw makeError('No compatible web3 wallet detected.', 'UNKNOWN_ERROR', { error: { code: 4900 } })
Copy link
Contributor

Choose a reason for hiding this comment

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

this error message and code repeats, we could make it a constant or a function

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True, created an issue for this #212

/**
* Match string equality
*/
export function areEqualStrings(a: string, b: string, caseSensitive?: true) {
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need non-case sensitive check? if so, you could just not call this function and use "a === b". And when you do, you could rename this function to "areEqualStringsCaseInsentive" or similar

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tracking this suggestion to #213 to push needed functionality to main

app/ts/context/Notification.tsx Outdated Show resolved Hide resolved
app/ts/library/errors.ts Outdated Show resolved Hide resolved
jubalm and others added 4 commits October 16, 2023 14:06
Co-authored-by: KillariDev <13102010+KillariDev@users.noreply.github.com>
Co-authored-by: KillariDev <13102010+KillariDev@users.noreply.github.com>
Co-authored-by: KillariDev <13102010+KillariDev@users.noreply.github.com>
@jubalm jubalm force-pushed the feature/improved-error-handling branch from ca80987 to a2f8e77 Compare October 16, 2023 06:41
@jubalm jubalm merged commit 6c98987 into master Oct 16, 2023
@jubalm jubalm deleted the feature/improved-error-handling branch October 16, 2023 06:50
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.

Show or prevent submit if amount > balance
2 participants