UNPKG

1.24 kBJavaScriptView Raw
1/**
2 * Copyright (c) 2013-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
8 *
9 *
10 */
11'use strict';
12
13/**
14 * WARNING: DO NOT manually require this module.
15 * This is a replacement for `invariant(...)` used by the error code system
16 * and will _only_ be required by the corresponding babel pass.
17 * It always throws.
18 */
19
20function reactProdInvariant(code) {
21 var argCount = arguments.length - 1;
22
23 var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
24
25 for (var argIdx = 0; argIdx < argCount; argIdx++) {
26 message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
27 }
28
29 message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
30
31 var error = new Error(message);
32 error.name = 'Invariant Violation';
33 error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
34
35 throw error;
36}
37
38module.exports = reactProdInvariant;
\No newline at end of file