Skip to content

Fix bug with mint url validation#860

Open
jbojcic1 wants to merge 2 commits intomasterfrom
fix-mint-validation-issue
Open

Fix bug with mint url validation#860
jbojcic1 wants to merge 2 commits intomasterfrom
fix-mint-validation-issue

Conversation

@jbojcic1
Copy link
Collaborator

@jbojcic1 jbojcic1 commented Feb 16, 2026

Fixes this Sentry error

We had a bug where if user enters a wrong url when adding a mint, or if the mint is temporarily down, the validation would error, we'd get an error log but the button would just keep spinning for the user.

@jbojcic1 jbojcic1 requested a review from gudnuf February 16, 2026 13:25
@jbojcic1 jbojcic1 self-assigned this Feb 16, 2026
@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agicash Ready Ready Preview, Comment Feb 16, 2026 11:48pm

Request Review

@supabase
Copy link

supabase bot commented Feb 16, 2026

This pull request has been ignored for the connected project hrebgkfhjpkbxpztqqke because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

queryClient.fetchQuery(allMintKeysetsQueryOptions(mintUrl)),
]);
return { success: true, data: { mintInfo, keysets: allKeysets.keysets } };
} catch (error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@gudnuf cashu-ts returns NetworkError instance for these errors but unfortunately the error is useless because it just gives us the generic message. Ideally we should be able to distinct error codes so we can know if the mint is not found or maybe in case of 500 error that it's just temporarily down. Because of this I used generic message that covers both cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

There's HttpResponseError too. This is from request.ts. It should throw HttpResponse error if it got a response and NetworkError if fetch failed

Image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

when I enter non existing mint url, I get NetworkError which doesn't have a status or anything. if I enter giberish url and also if I enter valid url that fails with 404:

Image

should we just treat all NetworkErrors as mint doesn't exist?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you enter a real mint url, but its offline it will be network error with no status? We don't know whether this means its a real mint or not, so I'd say your current error message is good for network errors.

Can you catch HttpResponseErrors for the case where you input valid url that returns a 404? Then we know its not a valid mint

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am not sure if that will even work. E.g. this dalmatinskiportal.hr that I tried is a local news site and it did return 404 but cashu-ts still threw NetworkError.

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.

2 participants