| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | // Do not require this module directly! Use normal `invariant` calls with |
| 10 | // template literal strings. The messages will be replaced with error codes |
| 11 | // during build. |
| 12 | |
| 13 | function formatProdErrorMessage(code) { |
| 14 | let url = 'https://react.dev/errors/' + code; |
| 15 | if (arguments.length > 1) { |
| 16 | url += '?args[]=' + encodeURIComponent(arguments[1]); |
| 17 | for (let i = 2; i < arguments.length; i++) { |
| 18 | url += '&args[]=' + encodeURIComponent(arguments[i]); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | return ( |
| 23 | `Minified React error #${code}; visit ${url} for the full message or ` + |
| 24 | 'use the non-minified dev environment for full errors and additional ' + |
| 25 | 'helpful warnings.' |
| 26 | ); |
| 27 | } |
| 28 | |
| 29 | export default formatProdErrorMessage; |