UNPKG

2.81 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.ReconcilerFatalError = exports.DoNotOptimize = exports.NewComponentTreeBranch = exports.UnsupportedSideEffect = exports.SimpleClassBailOut = exports.ExpectedBailOut = void 0;
7
8var _errors = require("../errors.js");
9
10/**
11 * Copyright (c) 2017-present, Facebook, Inc.
12 * All rights reserved.
13 *
14 * This source code is licensed under the BSD-style license found in the
15 * LICENSE file in the root directory of this source tree. An additional grant
16 * of patent rights can be found in the PATENTS file in the same directory.
17 */
18
19/* strict-local */
20// ExpectedBailOut is like an error, that gets thrown during the reconcilation phase
21// allowing the reconcilation to continue on other branches of the tree, the message
22// given to ExpectedBailOut will be assigned to the value.$BailOutReason property and serialized
23// as a comment in the output source to give the user hints as to what they need to do
24// to fix the bail-out case
25class ExpectedBailOut extends Error {} // SimpleClassBailOuts only occur when a simple class instance is created and used
26// bailing out here will result in a complex class instance being created after
27// and an alternative complex class component route being used
28
29
30exports.ExpectedBailOut = ExpectedBailOut;
31
32class SimpleClassBailOut extends Error {} // When the reconciler detectes a side-effect in pure evaluation, it throws one
33// of these errors. This will fall straight through the the wrapping React
34// component render try/catch, which will then throw an appropiate
35// ReconcilerFatalError along with information on the React component stack
36
37
38exports.SimpleClassBailOut = SimpleClassBailOut;
39
40class UnsupportedSideEffect extends Error {} // NewComponentTreeBranch only occur when a complex class is found in a
41// component tree and the reconciler can no longer fold the component of that branch
42
43
44exports.UnsupportedSideEffect = UnsupportedSideEffect;
45
46class NewComponentTreeBranch extends Error {
47 constructor(evaluatedNode) {
48 super();
49 this.evaluatedNode = evaluatedNode;
50 }
51
52}
53
54exports.NewComponentTreeBranch = NewComponentTreeBranch;
55
56class DoNotOptimize extends Error {} // Used when an entire React component tree has failed to optimize
57// this means there is a programming bug in the application that is
58// being Prepacked
59
60
61exports.DoNotOptimize = DoNotOptimize;
62
63class ReconcilerFatalError extends _errors.FatalError {
64 constructor(message, evaluatedNode) {
65 super(message);
66 evaluatedNode.status = "FATAL";
67 evaluatedNode.message = message;
68 this.evaluatedNode = evaluatedNode; // used for assertions in tests
69
70 this.__isReconcilerFatalError = true;
71 }
72
73}
74
75exports.ReconcilerFatalError = ReconcilerFatalError;
76//# sourceMappingURL=errors.js.map
\No newline at end of file