@itwin/presentation-common
Version:
Common pieces for iModel.js presentation packages
63 lines • 2.81 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* 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
*/
import { BentleyError } from "@itwin/core-bentley";
/**
* Status codes used by Presentation APIs.
* @public
*/
export 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 || (PresentationStatus = {}));
/**
* An error type thrown by Presentation APIs.
* @public
*/
export class PresentationError extends 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;
}
}
//# sourceMappingURL=Error.js.map