Skip to content

Commit

Permalink
hotfix(sentry): enhance error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyArt1 committed Dec 7, 2023
1 parent ac0ce92 commit 55e1b0e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/[lang]/register/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ export function Form({ cedula }: Props) {
setLoading(false);

if (err.response?.data) {
const errorData = err.response.data;

const { ui, error } = errorData;
const { ui, error } = err.response.data;

type Message = { type: string; text: string };
type Node = { messages: Array<Message> };
Expand All @@ -181,7 +179,10 @@ export function Form({ cedula }: Props) {
.concat(messages, nodes, error?.id)
.filter(Boolean);

Sentry.captureException({ errors });
Sentry.captureMessage(errors.join(', '), {
level: 'error',
extra: { errors },
});
}

// If the previous handler did not catch the error it's most likely a form validation error
Expand Down

0 comments on commit 55e1b0e

Please sign in to comment.