{"version":3,"file":"AlreadyReportedError.js","sourceRoot":"","sources":["../src/AlreadyReportedError.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yCAAsC;AAEtC,MAAM,wBAAwB,GAAW,sCAAsC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IAC7C;QACE,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAE5B,sGAAsG;QACtG,2RAA2R;QAC3R,EAAE;QACF,4EAA4E;QAC3E,IAAY,CAAC,SAAS,GAAG,oBAAoB,CAAC,SAAS,CAAC,CAAC,yDAAyD;IACrH,CAAC;IAEM,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,QAAgB;QACjD,OAAO,mBAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;IACnE,CAAC;CACF;AAdD,oDAcC;AAED,mBAAQ,CAAC,aAAa,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { TypeUuid } from './TypeUuid';\n\nconst uuidAlreadyReportedError: string = 'f26b0640-a49b-49d1-9ead-1a516d5920c7';\n\n/**\n * This exception can be thrown to indicate that an operation failed and an error message has already\n * been reported appropriately. Thus, the catch handler does not have responsibility for reporting\n * the error.\n *\n * @remarks\n * For example, suppose a tool writes interactive output to `console.log()`. When an exception is thrown,\n * the `catch` handler will typically provide simplistic reporting such as this:\n *\n * ```ts\n * catch (error) {\n * console.log(\"ERROR: \" + error.message);\n * }\n * ```\n *\n * Suppose that the code performing the operation normally prints rich output to the console. It may be able to\n * present an error message more nicely (for example, as part of a table, or structured log format). Throwing\n * `AlreadyReportedError` provides a way to use exception handling to abort the operation, but instruct the `catch`\n * handler not to print an error a second time:\n *\n * ```ts\n * catch (error) {\n * if (error instanceof AlreadyReportedError) {\n * return;\n * }\n * console.log(\"ERROR: \" + error.message);\n * }\n * ```\n *\n * @public\n */\nexport class AlreadyReportedError extends Error {\n public constructor() {\n super('An error occurred.');\n\n // Manually set the prototype, as we can no longer extend built-in classes like Error, Array, Map, etc\n // [https://github.com/microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work](https://github.com/microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work)\n //\n // Note: the prototype must also be set on any classes which extend this one\n (this as any).__proto__ = AlreadyReportedError.prototype; // eslint-disable-line @typescript-eslint/no-explicit-any\n }\n\n public static [Symbol.hasInstance](instance: object): boolean {\n return TypeUuid.isInstanceOf(instance, uuidAlreadyReportedError);\n }\n}\n\nTypeUuid.registerClass(AlreadyReportedError, uuidAlreadyReportedError);\n"]}