react/packages/shared/formatProdErrorMessage.js

26 lines
825 B
JavaScript
Raw Permalink Normal View History

2019-03-19 04:58:03 +08:00
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
2019-03-19 04:58:03 +08: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-19 04:58:03 +08:00
function formatProdErrorMessage(code) {
2019-03-19 04:58:03 +08:00
let url = 'https://reactjs.org/docs/error-decoder.html?invariant=' + code;
for (let i = 1; i < arguments.length; i++) {
url += '&args[]=' + encodeURIComponent(arguments[i]);
}
return (
2019-03-19 04:58:03 +08: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-19 04:58:03 +08:00
}
export default formatProdErrorMessage;