@rushstack/operation-graph
Version:
Library for managing and executing operations in a directed acyclic graph.
29 lines • 1.09 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.OperationError = void 0;
/**
* Encapsulates information about an error
*
* @beta
*/
class OperationError extends Error {
constructor(type, message) {
super(message);
// Manually set the prototype, as we can no longer extend built-in classes like Error, Array, Map, etc.
// https://github.com/microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
//
// Note: the prototype must also be set on any classes which extend this one
Object.setPrototypeOf(this, OperationError.prototype);
this._type = type;
}
get message() {
return `[${this._type}] '${super.message}'`;
}
toString() {
return this.message;
}
}
exports.OperationError = OperationError;
//# sourceMappingURL=OperationError.js.map