-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Rewrite Redux core error messages #4055
Conversation
- Added miniature port of `kindOf` for better `typeof` descriptions - Used `kindOf` for all runtime type check errors - Inlined "slice reducer returned undefined" error message - Rewrote "actions must be plain objects" error message to show the actual variable type and added tests - Reworded a bunch of error messages - Added some additional docs links - Updated tests that check error messages
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c83b014:
|
Size Change: +363 B (4%) Total Size: 8.58 kB
|
Deploy preview for redux-docs ready! Built with commit c83b014 |
errors.json
Outdated
"10": "Expected the nextReducer to be a function. Instead, received: '", | ||
"11": "Expected the observer to be an object. Instead, received: ''", | ||
"12": "The slice reducer for key \"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.", | ||
"13": "The slice reducer for key \"\" returned undefined when probed with a random type. Don't try to handle or other actions in \"redux/*\" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.", |
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.
Don't try to handle or other actions in "redux/*" namespace.
Is this missing a char or '' to get replaced that I'm not seeing?
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.
There's a template literal interpolation there:
`Don't try to handle ${ActionTypes.INIT} or other actions
and that doesn't get included in the extracted message.
I'll add single quotes around it, though.
ed6b5cc
to
c83b014
Compare
Going in! Next up, porting this whole set of changes to |
…sages Former-commit-id: 836784f
name: 🐛 Bug fix or new feature
about: Fixing a problem with Redux
This PR:
errors.json
file with the updated errors, since none of our errors have been released yet