Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: suppress "ConditionError" in Logger #6213

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/redux/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@
Logger.debug('redux/saga@logger', `${action.type} (payload not logged)`)
return
}

/**
* This is not an actual error but rather a way for Redux Toolkit to signal that a thunk
* condition (most likely caused by RTK-Query) has evaluated to false and cancelled the thunk
* execution OR the thunk execution was aborted. As can be seen from the Redux Toolkit code,
* this is not an actual Error class instance but just a way of signaling the failed condition
* necessary to execute the thunk.
*
* For more context, please check out the following links:
* https://github.com/reduxjs/redux-toolkit/blob/7af5345eaeab83ca57b439aec41819420c503b34/packages/toolkit/src/createAsyncThunk.ts#L596-L602
* https://stackoverflow.com/questions/69789058/what-does-this-error-mean-in-redux-toolkit
* https://redux-toolkit.js.org/api/createAsyncThunk#options
*/
if ((action?.error as any)?.name === 'ConditionError') {
return

Check warning on line 109 in src/redux/sagas.ts

View check run for this annotation

Codecov / codecov/patch

src/redux/sagas.ts#L109

Added line #L109 was not covered by tests
}

try {
Logger.debug('redux/saga@logger', action)
} catch (err) {
Expand Down