You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of firestore related errors will happen in redux functions: either in thunks updating the db, or selectors reading from (would be) corrupt db. Taking this into account, in the spirit of composability, I propose we devise a flow where all redux interactions will be "instrumented" to catch errors, provide fallbacks and report errors, along with the state to sentry.
Thunks
We already have thunk type, but we could write a function createThunk, which would wrap each thunk with an error handler:
the handler will try to execute the thunk, if successful, it could, optionally enqueue a success message
if the handler fails:
it will enqueue an error message (the message provided to createThunk or, if absent, a generic error message)
it will send a report to sentry, containing the name of the thunk, the error (with stack trace) and additional metadata: with which params was the thunk called, etc.
Selectors
We could create a wrapper createSelector which will take in a selector function, a fallback (to be returned safely in case of error), wrap the selector so that if it fails, it will return a fallback and send message to sentry, including the stack trace and metadata.
Metadata
As for the metadata, it should, at least, contain the params the thunk/selector was called with. It could return the entire state of the store as well (redux store) and it could, if we chose so, include a context object (like we did in librocco) to provide the full data on which part of the app called it.
The text was updated successfully, but these errors were encountered:
Most of firestore related errors will happen in redux functions: either in thunks updating the db, or selectors reading from (would be) corrupt db. Taking this into account, in the spirit of composability, I propose we devise a flow where all redux interactions will be "instrumented" to catch errors, provide fallbacks and report errors, along with the state to sentry.
Thunks
We already have thunk type, but we could write a function
createThunk
, which would wrap each thunk with an error handler:createThunk
or, if absent, a generic error message)Selectors
We could create a wrapper
createSelector
which will take in a selector function, a fallback (to be returned safely in case of error), wrap the selector so that if it fails, it will return a fallback and send message to sentry, including the stack trace and metadata.Metadata
As for the metadata, it should, at least, contain the params the thunk/selector was called with. It could return the entire state of the store as well (redux store) and it could, if we chose so, include a context object (like we did in librocco) to provide the full data on which part of the app called it.
The text was updated successfully, but these errors were encountered: