-
Notifications
You must be signed in to change notification settings - Fork 47.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve error codes for invariants on www
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
const invariant = require('invariant'); | ||
|
||
function reactProdInvariant(code: string): void { | ||
const argCount = arguments.length - 1; | ||
|
||
let message = | ||
'Minified React error #' + | ||
code + | ||
'; visit ' + | ||
'http://reactjs.org/docs/error-decoder.html?invariant=' + | ||
code; | ||
|
||
for (let argIdx = 0; argIdx < argCount; argIdx++) { | ||
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); | ||
} | ||
|
||
message += | ||
' for the full message or use the non-minified dev environment' + | ||
' for full errors and additional helpful warnings.'; | ||
|
||
// www doesn't strip this because we mark the React bundle | ||
// with @preserve-invariant-messages docblock. | ||
// eslint-disable-next-line react-internal/warning-and-invariant-args | ||
invariant(false, message); | ||
} | ||
|
||
export default reactProdInvariant; |
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
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
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