forked from apollographql/apollo-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate @apollo/client/invariantErrorCodes.js for each release. (apo…
…llographql#6665) When an invariant fails in production, a cryptic numeric error of the form `Invariant Violation: 42` is thrown, with a reference to the error codes section of invariant-packages README.md: https://github.com/apollographql/invariant-packages#error-codes This vague guidance has not proven adequate in many cases, to say the least: see apollographql/invariant-packages#18, apollographql/invariant-packages#19, apollographql#6604, However, this vague guidance (which was intended to suggest searching your installed node_modules/@apollo/client package for the error code) has not proven adequate in many cases, to say the least: see apollographql/invariant-packages#18, apollographql/invariant-packages#19, apollographql#6604, apollographql#5730, apollographql#5291, and apollographql#5975, to cite just a few of the many issues we've seen since apollographql#4521. Using error codes instead of error strings remains important for production bundle sizes, but I think we can make it substantially easier to look up the error string corresponding to each error code, by generating a single file containing all the invariant error codes for each @apollo/client release. Starting with Apollo Client 3.1.0, this manifest file can be found in @apollo/client/invariantErrorCodes.js (using an npm/yarn-installed copy of @apollo/client, since this file is generated in the ./dist directory, not checked into the repository). The file contains an explanatory comment, the @apollo/client version, and a sequential map from error numbers to the { file, node } responsible for the error.
- Loading branch information
1 parent
42099c9
commit e80835f
Showing
2 changed files
with
54 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters