UNPKG

@itwin/presentation-common

Version:

Common pieces for iModel.js presentation packages

67 lines 3.03 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module Core */ Object.defineProperty(exports, "__esModule", { value: true }); exports.PresentationError = exports.PresentationStatus = void 0; const core_bentley_1 = require("@itwin/core-bentley"); /** * Status codes used by Presentation APIs. * @public */ var PresentationStatus; (function (PresentationStatus) { /** Success result. */ PresentationStatus[PresentationStatus["Success"] = 0] = "Success"; /** Request was cancelled. */ PresentationStatus[PresentationStatus["Canceled"] = 1] = "Canceled"; /** Error: Unknown */ PresentationStatus[PresentationStatus["Error"] = 65536] = "Error"; /** Error: Backend is not initialized. */ PresentationStatus[PresentationStatus["NotInitialized"] = 65537] = "NotInitialized"; /** Error: Result set is too large. */ PresentationStatus[PresentationStatus["ResultSetTooLarge"] = 65538] = "ResultSetTooLarge"; /** Error: Argument is invalid. */ PresentationStatus[PresentationStatus["InvalidArgument"] = 65539] = "InvalidArgument"; /** * Timeout for the request was reached which prevented it from being fulfilled. Frontend may * repeat the request. * * @deprecated in 5.0 - will not be removed until after 2026-06-13. Presentation RPC now relies on `RpcPendingResponse` to handle timeouts. */ PresentationStatus[PresentationStatus["BackendTimeout"] = 65543] = "BackendTimeout"; })(PresentationStatus || (exports.PresentationStatus = PresentationStatus = {})); /** * An error type thrown by Presentation APIs. * @public */ class PresentationError extends core_bentley_1.BentleyError { /** * Creates an instance of Error. * @param errorNumber Error code * @param message Optional brief description of the error. The `message` property combined with the `name` * property is used by the `Error.prototype.toString()` method to create a string representation of the Error. * @param log Optional log function which logs the error. * @param getMetaData Optional function that returns meta-data related to an error. */ constructor(errorNumber, message, getMetaData) { super(errorNumber, message, getMetaData); } /** * Returns the name of each error status. The name is used by the `Error.prototype.toString()` * method to create a string representation of the error. */ _initName() { let value = PresentationStatus[this.errorNumber]; if (!value) { value = `Unknown Error (${this.errorNumber})`; } return value; } } exports.PresentationError = PresentationError; //# sourceMappingURL=Error.js.map