-
Notifications
You must be signed in to change notification settings - Fork 87
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
base: main
Are you sure you want to change the base?
Conversation
src/utils/Logger.ts
Outdated
* https://stackoverflow.com/questions/69789058/what-does-this-error-mean-in-redux-toolkit | ||
* https://redux-toolkit.js.org/api/createAsyncThunk#options | ||
*/ | ||
if (messages?.[0]?.error?.name === 'ConditionError') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case, I've ran a check in node_modules
to ensure no other dependency is throwing ConditionError
. The only library using is is Redux Toolkit and the only place where this particular error is thrown is in the only place in their codebase that I've linked there in the comment (first link).
So it is safe to assume that suppressing this error will not suppress any errors that we do not want to suppress.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of doing this in the logger saga instead?
Lines 77 to 101 in 34a9d38
function* loggerSaga() { | |
const devModeActive: boolean = yield* select(devModeSelector) | |
if (!devModeActive) { | |
return | |
} | |
yield* takeEvery('*', (action: UnknownAction) => { | |
if ( | |
action?.type && | |
(action.type.includes('IDENTITY/') || loggerPayloadBlocklist.includes(action.type)) | |
) { | |
// Log only action type, but not the payload as it can have sensitive | |
// information or information that is not helpful for debugging. Excluding | |
// all IDENTITY/ actions because high likelyhood they contain PII and the | |
// blocklist may get out of date. | |
Logger.debug('redux/saga@logger', `${action.type} (payload not logged)`) | |
return | |
} | |
try { | |
Logger.debug('redux/saga@logger', action) | |
} catch (err) { | |
Logger.warn('redux/saga@logger', 'could not log action of type', action.type) | |
} | |
}) | |
} |
This way it's more targeted. And the logger doesn't need to know about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeanregisser I think it makes sense, will do!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeanregisser updated
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6213 +/- ##
==========================================
- Coverage 88.93% 88.92% -0.01%
==========================================
Files 737 737
Lines 31370 31381 +11
Branches 5796 5805 +9
==========================================
+ Hits 27898 27906 +8
- Misses 3274 3431 +157
+ Partials 198 44 -154
... and 69 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Description
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 signalling the failed conditionnecessary to execute the thunk.
For more context, please check out the following links:
https://stackoverflow.com/questions/69789058/what-does-this-error-mean-in-redux-toolkit
https://redux-toolkit.js.org/api/createAsyncThunk#options
Test plan
N/A
Related issues
N/A
Backwards compatibility
Yes
Network scalability
If a new NetworkId and/or Network are added in the future, the changes in this PR will: