UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

107 lines 4.67 kB
/** @packageDocumentation * @module iModels */ import { ITwinError } from "@itwin/core-bentley"; /** * An error originating from the [SQLiteDb]($backend) API. * @beta */ export interface SqliteError extends ITwinError { /** The name of the database for this problem. */ dbName: string; } /** @beta */ export declare namespace SqliteError { const scope = "itwin-Sqlite"; type Key = "already-open" | "incompatible-version" | "invalid-versions-property" | "readonly"; /** Determine whether an error object is a SqliteError */ function isError(error: unknown, key?: Key): error is SqliteError; /** Instantiate and throw a SqliteError */ function throwError(key: Key, message: string, dbName: string): never; } /** * An error originating from the [CloudSqlite]($backend) API. * @beta */ export interface CloudSqliteError extends ITwinError { /** The name of the database that generated the error */ readonly dbName?: string; /** The name of the container associated with the error */ readonly containerId?: string; } /** @beta */ export declare namespace CloudSqliteError { const scope = "itwin-CloudSqlite"; type Key = "already-published" | "copy-error" | "invalid-name" | "no-version-available" | "not-a-function" | "service-not-available" | /** The write lock cannot be acquired because it is currently held by somebody else. * @see WriteLockHeld for details */ "write-lock-held" | /** The write lock on a container is not held, but is required for this operation */ "write-lock-not-held"; /** thrown when an attempt to acquire the write lock for a container fails because the lock is already held by somebody else ("write-lock-held"). */ interface WriteLockHeld extends CloudSqliteError { /** @internal */ errorNumber: number; /** moniker of user currently holding container's lock */ lockedBy: string; /** time the lock expires */ expires: string; } /** Determine whether an error object is a CloudSqliteError */ function isError<T extends CloudSqliteError>(error: unknown, key?: Key): error is T; /** Instantiate and throw a CloudSqliteError */ function throwError<T extends CloudSqliteError>(key: Key, e: Omit<T, "name" | "iTwinErrorId">): never; } /** Errors thrown by the [ViewStore]($backend) API. * @beta */ export interface ViewStoreError extends ITwinError { /** The name of the ViewStore that generated the error */ viewStoreName?: string; } /** @beta */ export declare namespace ViewStoreError { const scope = "itwin-ViewStore"; type Key = "invalid-value" | "invalid-member" | "no-owner" | "not-found" | "not-unique" | "no-viewstore" | "group-error"; /** Determine whether an error object is a ViewStoreError */ function isError<T extends ViewStoreError>(error: unknown, key?: Key): error is T; /** Instantiate and throw a ViewStoreError */ function throwError<T extends ViewStoreError>(key: Key, e: Omit<T, "name" | "iTwinErrorId">): never; } /** * Errors thrown by the [Workspace]($backend) APIs. * @beta */ export declare namespace WorkspaceError { const scope = "itwin-Workspace"; type Key = "already-exists" | "container-exists" | "does-not-exist" | "invalid-name" | "no-cloud-container" | "load-error" | "load-errors" | "resource-exists" | "too-large" | "write-error"; /** Determine whether an error object is a WorkspaceError */ function isError<T extends ITwinError>(error: unknown, key?: Key): error is T; function throwError<T extends ITwinError>(key: Key, e: Omit<T, "name" | "iTwinErrorId">): never; } /** Errors originating from the [ChannelControl]($backend) interface. * @beta */ export interface ChannelControlError extends ITwinError { /** The channel key that caused the error. */ readonly channelKey: string; } /** @beta */ export declare namespace ChannelControlError { /** the ITwinError scope for `ChannelControlError`s. */ const scope = "itwin-ChannelControl"; /** Keys that identify `ChannelControlError`s */ type Key = /** an attempt to create a channel within an existing channel */ "may-not-nest" | /** an attempt to use a channel that was not "allowed" */ "not-allowed" | /** the root channel already exists */ "root-exists"; /** Instantiate and throw a ChannelControlError */ function throwError(key: Key, message: string, channelKey: string): never; /** Determine whether an error object is a ChannelControlError */ function isError(error: unknown, key?: Key): error is ChannelControlError; } //# sourceMappingURL=ITwinCoreErrors.d.ts.map