Files
react/packages/shared/formatProdErrorMessage.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
895 B
JavaScript
Raw Normal View History

2019-03-18 13:58:03 -07:00
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
2019-03-18 13:58:03 -07:00
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
// Do not require this module directly! Use normal `invariant` calls with
// template literal strings. The messages will be replaced with error codes
// during build.
2019-03-18 13:58:03 -07:00
function formatProdErrorMessage(code) {
let url = 'https://react.dev/errors/' + code;
if (arguments.length > 1) {
url += '?args[]=' + encodeURIComponent(arguments[1]);
for (let i = 2; i < arguments.length; i++) {
url += '&args[]=' + encodeURIComponent(arguments[i]);
}
2019-03-18 13:58:03 -07:00
}
return (
2019-03-18 13:58:03 -07:00
`Minified React error #${code}; visit ${url} for the full message or ` +
'use the non-minified dev environment for full errors and additional ' +
'helpful warnings.'
);
2019-03-18 13:58:03 -07:00
}
export default formatProdErrorMessage;