forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlreadyReportedError.ts
More file actions
20 lines (17 loc) · 1.05 KB
/
AlreadyReportedError.ts
File metadata and controls
20 lines (17 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
/**
* This exception is thrown to indicate that the operation failed, but an
* appropriate error message was already printed to the console. The catch
* block should not print any error.
*/
export class AlreadyReportedError extends Error {
public constructor() {
super('An error occurred.');
// 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](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
(this as any).__proto__ = AlreadyReportedError.prototype; // eslint-disable-line @typescript-eslint/no-explicit-any
}
}