feat: user friendly stripe error message shown to user#92
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve how Stripe-related errors are surfaced in the join flow UI by showing more user-friendly messages, while capturing more diagnostic context for failures.
Changes:
- Updated
usePostResourceto throw an error with HTTP context and attach the raw response body onto the error object. - Added Stripe error formatting/mapping to display user-friendly messages for selected Stripe error codes and hide technical errors behind a generic message.
- Updated the payment form UI to render the error message using Bootstrap “invalid-feedback” styling and added additional Sentry reporting for confirmPayment failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/join-flow/src/services/rest-resource.service.ts | Changes thrown error shape/message for failed REST POSTs and attaches response body to the error object. |
| packages/join-flow/src/pages/payment-details.page.tsx | Adds Stripe error-to-message formatting, logs confirmPayment errors to Sentry, and improves error message styling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!res.ok) { | ||
| throw Error(await res.text()); | ||
| const body = await res.text(); | ||
| const err = new Error(`HTTP ${res.status} error from ${resource}`); |
Comment on lines
+432
to
+435
| Sentry.captureMessage("Stripe confirmPayment error", { | ||
| level: "error", | ||
| extra: { stripeError: error }, | ||
| }); |
37f9347 to
5d8cc7b
Compare
Comment on lines
+22
to
+24
| const err = new Error(body) as Error & { status: number; resource: string }; | ||
| err.status = res.status; | ||
| err.resource = resource; |
Comment on lines
440
to
445
| } catch (e: any) { | ||
| console.error("Create payment error", e); | ||
| handleError({ message: e?.message || JSON.stringify(e) || "Unknown error" }); | ||
| Sentry.captureException(e) | ||
| Sentry.captureException(e); | ||
| setLoading(false); | ||
| setErrorMessage(GENERIC_PAYMENT_ERROR); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.