Skip to content

Commit bb14c1a

Browse files
committed
Change log level for fetch errors in template
1 parent 7be71b2 commit bb14c1a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

templates/api-v5/internal/js/src/redux-modules/loggerMiddleware.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const loggerMiddleware = () => (next) => (action) => {
1010
if (process.env.NODE_ENV === 'development') {
1111
console.warn('redux action error', action);
1212
}
13-
logger.error(
13+
const isFetchError = metaAction.payload?.status === 'FETCH_ERROR';
14+
logger[isFetchError ? 'warning' : 'error'](
1415
{
1516
message: 'redux action error',
1617
customText: metaAction.type,

templates/api-v5/internal/ts/src/redux-modules/loggerMiddleware.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const loggerMiddleware: Middleware = () => (next) => (action) => {
2525
// eslint-disable-next-line no-console
2626
console.warn('redux action error', action);
2727
}
28-
logger.error(
28+
const isFetchError = (metaAction.payload as undefined | { status?: string | number })?.status === 'FETCH_ERROR';
29+
logger[isFetchError ? 'warning' : 'error'](
2930
{
3031
message: 'redux action error',
3132
customText: metaAction.type,

0 commit comments

Comments
 (0)