Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Sentry 캡쳐 에러를 prod 환경에서만 실행되도록 설정
Browse files Browse the repository at this point in the history
jinhokim98 committed Aug 15, 2024
1 parent 6403ec7 commit 99170e9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions client/src/apis/useFetch.ts
Original file line number Diff line number Diff line change
@@ -45,10 +45,17 @@ export const useFetch = () => {
onError();
}

captureError(error, navigate, eventId);
// prod 환경에서만 Sentry capture 실행
if (process.env.NODE_ENV === 'production') {
captureError(error, navigate, eventId);
}
} else {
setError({errorCode: UNKNOWN_ERROR, message: JSON.stringify(error)});
captureError(new Error(UNKNOWN_ERROR), navigate, eventId);

// prod 환경에서만 Sentry capture 실행
if (process.env.NODE_ENV === 'production') {
captureError(new Error(UNKNOWN_ERROR), navigate, eventId);
}

// 에러를 throw 해 에러 바운더리로 보냅니다. 따라서 에러 이름은 중요하지 않음
throw new Error(UNKNOWN_ERROR);

0 comments on commit 99170e9

Please sign in to comment.