/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module iModels
 */
import { ITwinError } from "@itwin/core-bentley";
/** @beta */
export var SqliteError;
(function (SqliteError) {
    SqliteError.scope = "itwin-Sqlite";
    /** Determine whether an error object is a SqliteError */
    function isError(error, key) {
        return ITwinError.isError(error, SqliteError.scope, key) && typeof error.dbName === "string";
    }
    SqliteError.isError = isError;
    /** Instantiate and throw a SqliteError */
    function throwError(key, message, dbName) {
        ITwinError.throwError({ iTwinErrorId: { scope: SqliteError.scope, key }, message, dbName });
    }
    SqliteError.throwError = throwError;
})(SqliteError || (SqliteError = {}));
/** @beta */
export var CloudSqliteError;
(function (CloudSqliteError) {
    CloudSqliteError.scope = "itwin-CloudSqlite";
    /** Determine whether an error object is a CloudSqliteError */
    function isError(error, key) {
        return ITwinError.isError(error, CloudSqliteError.scope, key);
    }
    CloudSqliteError.isError = isError;
    /** Instantiate and throw a CloudSqliteError */
    function throwError(key, e) {
        ITwinError.throwError({ ...e, iTwinErrorId: { scope: CloudSqliteError.scope, key } });
    }
    CloudSqliteError.throwError = throwError;
})(CloudSqliteError || (CloudSqliteError = {}));
/** @beta */
export var ViewStoreError;
(function (ViewStoreError) {
    ViewStoreError.scope = "itwin-ViewStore";
    /** Determine whether an error object is a ViewStoreError */
    function isError(error, key) {
        return ITwinError.isError(error, ViewStoreError.scope, key);
    }
    ViewStoreError.isError = isError;
    /** Instantiate and throw a ViewStoreError */
    function throwError(key, e) {
        ITwinError.throwError({ ...e, iTwinErrorId: { scope: ViewStoreError.scope, key } });
    }
    ViewStoreError.throwError = throwError;
})(ViewStoreError || (ViewStoreError = {}));
/**
 * Errors thrown by the [Workspace]($backend) APIs.
 * @beta
 */
export var WorkspaceError;
(function (WorkspaceError) {
    WorkspaceError.scope = "itwin-Workspace";
    /** Determine whether an error object is a WorkspaceError */
    function isError(error, key) {
        return ITwinError.isError(error, WorkspaceError.scope, key);
    }
    WorkspaceError.isError = isError;
    function throwError(key, e) {
        ITwinError.throwError({ ...e, iTwinErrorId: { key, scope: WorkspaceError.scope } });
    }
    WorkspaceError.throwError = throwError;
})(WorkspaceError || (WorkspaceError = {}));
/** @beta */
export var ChannelControlError;
(function (ChannelControlError) {
    /** the ITwinError scope for `ChannelControlError`s. */
    ChannelControlError.scope = "itwin-ChannelControl";
    /** Instantiate and throw a ChannelControlError */
    function throwError(key, message, channelKey) {
        ITwinError.throwError({ iTwinErrorId: { scope: ChannelControlError.scope, key }, message, channelKey });
    }
    ChannelControlError.throwError = throwError;
    /** Determine whether an error object is a ChannelControlError */
    function isError(error, key) {
        return ITwinError.isError(error, ChannelControlError.scope, key) && typeof error.channelKey === "string";
    }
    ChannelControlError.isError = isError;
})(ChannelControlError || (ChannelControlError = {}));
//# sourceMappingURL=ITwinCoreErrors.js.map