54 lines
2.4 KiB
JavaScript
54 lines
2.4 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.FatalError = FatalError;
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
|
|
// This is the error format used to report errors to the caller-supplied
|
|
// error-handler
|
|
/**
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
var CompilerDiagnostic = exports.CompilerDiagnostic = function (_Error) {
|
|
_inherits(CompilerDiagnostic, _Error);
|
|
|
|
function CompilerDiagnostic(message, location, errorCode, severity) {
|
|
_classCallCheck(this, CompilerDiagnostic);
|
|
|
|
var _this = _possibleConstructorReturn(this, (CompilerDiagnostic.__proto__ || Object.getPrototypeOf(CompilerDiagnostic)).call(this, message));
|
|
|
|
_this.location = location;
|
|
_this.severity = severity;
|
|
_this.errorCode = errorCode;
|
|
return _this;
|
|
}
|
|
|
|
return CompilerDiagnostic;
|
|
}(Error);
|
|
|
|
// This error is thrown to exit Prepack when an ErrorHandler returns 'FatalError'
|
|
// This should just be a class but Babel classes doesn't work with
|
|
// built-in super classes.
|
|
|
|
|
|
function FatalError(message) {
|
|
var self = new Error(message || "A fatal error occurred while prepacking.");
|
|
Object.setPrototypeOf(self, FatalError.prototype);
|
|
return self;
|
|
}
|
|
Object.setPrototypeOf(FatalError, Error);
|
|
Object.setPrototypeOf(FatalError.prototype, Error.prototype);
|
|
//# sourceMappingURL=errors.js.map
|