Skip to content

Commit

Permalink
no-log errors are no longer logged to console in dev environment
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik committed Nov 28, 2024
1 parent 1c847f1 commit 1aba7e9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions storefront/urql/errorExchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const getErrorExchange =
}

if (isWithErrorDebugging) {
handleErrorMessagesForDevelopment(error);
handleErrorMessagesForDevelopment(error, t);
} else {
handleErrorMessagesForUsers(error, t, operation);
}
Expand All @@ -58,12 +58,16 @@ export const getErrorExchange =
};
};

const handleErrorMessagesForDevelopment = (error: CombinedError) => {
logException({
message: error.message,
originalError: JSON.stringify(error),
location: 'getErrorExchange.handleErrorMessagesForDevelopment',
});
const handleErrorMessagesForDevelopment = (error: CombinedError, t: Translate) => {
const parsedErrors = getUserFriendlyErrors(error, t);

if (!parsedErrors.applicationError || !isNoLogError(parsedErrors.applicationError.type)) {
logException({
message: error.message,
originalError: JSON.stringify(error),
location: 'getErrorExchange.handleErrorMessagesForDevelopment',
});
}

if (isWithToastAndConsoleErrorDebugging) {
error.graphQLErrors
Expand Down

0 comments on commit 1aba7e9

Please sign in to comment.