Skip to content

Commit

Permalink
🆙 Sign up and sentry improvements (#4908)
Browse files Browse the repository at this point in the history
* Avoid overriding main error with context values

* Make sure to do not use error as key for senty log context

* Close signup modal on faucet error
  • Loading branch information
WRadoslaw authored Sep 21, 2023
1 parent 43aab28 commit 0c41bc2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
10 changes: 3 additions & 7 deletions packages/atlas/src/components/_auth/SignUpModal/SignUpModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useGetMembershipsLazyQuery } from '@/api/queries/__generated__/membersh
import { Button } from '@/components/_buttons/Button'
import { DialogButtonProps } from '@/components/_overlays/Dialog'
import { DialogModal } from '@/components/_overlays/DialogModal'
import { AccountFormData, FaucetError, MemberFormData, RegisterError, useCreateMember } from '@/hooks/useCreateMember'
import { AccountFormData, MemberFormData, RegisterError, useCreateMember } from '@/hooks/useCreateMember'
import { useMediaMatch } from '@/hooks/useMediaMatch'
import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
import { useUniqueMemberHandle } from '@/hooks/useUniqueMemberHandle'
Expand Down Expand Up @@ -214,12 +214,8 @@ export const SignUpModal = () => {
onStart: () => {
goToStep(SignUpSteps.Creating)
},
onError: (error) => {
if (error === FaucetError.MemberAlreadyCreatedForGoogleAccount) {
setAuthModalOpenName(undefined)
} else {
goToStep(SignUpSteps.CreateMember)
}
onError: () => {
setAuthModalOpenName(undefined)
},
})
if (memberId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const MultiFileSelect: FC<MultiFileSelectProps> = memo(
} else if (errorCode === 'file-too-large') {
setError('File too large')
} else {
SentryLogger.error('Unknown file select error', 'MultiFileSelect', null, { error: { code: errorCode } })
SentryLogger.error('Unknown file select error', 'MultiFileSelect', null, { parsedError: { code: errorCode } })
setError('Unknown error')
}
}, [])
Expand Down
4 changes: 3 additions & 1 deletion packages/atlas/src/hooks/useCreateMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export const useCreateMember = () => {

const errorCode = isAxiosError<NewMemberErrorResponse>(error) ? error.response?.data?.error : null

SentryLogger.error('Failed to create a membership', 'SignUpModal', error, { error: { errorCode } })
SentryLogger.error(`Failed to create a membership ${ytResponseData ? 'YPP' : ''}`, 'SignUpModal', error, {
parsed: { errorCode },
})

switch (errorCode) {
case 'TooManyRequestsPerIp':
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas/src/utils/logs/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class _SentryLogger {

Sentry.captureException(new SentryError(title, message), {
contexts: {
error,
...contexts,
error,
},
tags,
user: { ...this.user, ip_address: '{{auto}}' },
Expand Down

0 comments on commit 0c41bc2

Please sign in to comment.