"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 iModels
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelControlError = exports.WorkspaceError = exports.ViewStoreError = exports.CloudSqliteError = exports.SqliteError = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
/** @beta */
var SqliteError;
(function (SqliteError) {
    SqliteError.scope = "itwin-Sqlite";
    /** Determine whether an error object is a SqliteError */
    function isError(error, key) {
        return core_bentley_1.ITwinError.isError(error, SqliteError.scope, key) && typeof error.dbName === "string";
    }
    SqliteError.isError = isError;
    /** Instantiate and throw a SqliteError */
    function throwError(key, message, dbName) {
        core_bentley_1.ITwinError.throwError({ iTwinErrorId: { scope: SqliteError.scope, key }, message, dbName });
    }
    SqliteError.throwError = throwError;
})(SqliteError || (exports.SqliteError = SqliteError = {}));
/** @beta */
var CloudSqliteError;
(function (CloudSqliteError) {
    CloudSqliteError.scope = "itwin-CloudSqlite";
    /** Determine whether an error object is a CloudSqliteError */
    function isError(error, key) {
        return core_bentley_1.ITwinError.isError(error, CloudSqliteError.scope, key);
    }
    CloudSqliteError.isError = isError;
    /** Instantiate and throw a CloudSqliteError */
    function throwError(key, e) {
        core_bentley_1.ITwinError.throwError({ ...e, iTwinErrorId: { scope: CloudSqliteError.scope, key } });
    }
    CloudSqliteError.throwError = throwError;
})(CloudSqliteError || (exports.CloudSqliteError = CloudSqliteError = {}));
/** @beta */
var ViewStoreError;
(function (ViewStoreError) {
    ViewStoreError.scope = "itwin-ViewStore";
    /** Determine whether an error object is a ViewStoreError */
    function isError(error, key) {
        return core_bentley_1.ITwinError.isError(error, ViewStoreError.scope, key);
    }
    ViewStoreError.isError = isError;
    /** Instantiate and throw a ViewStoreError */
    function throwError(key, e) {
        core_bentley_1.ITwinError.throwError({ ...e, iTwinErrorId: { scope: ViewStoreError.scope, key } });
    }
    ViewStoreError.throwError = throwError;
})(ViewStoreError || (exports.ViewStoreError = ViewStoreError = {}));
/**
 * Errors thrown by the [Workspace]($backend) APIs.
 * @beta
 */
var WorkspaceError;
(function (WorkspaceError) {
    WorkspaceError.scope = "itwin-Workspace";
    /** Determine whether an error object is a WorkspaceError */
    function isError(error, key) {
        return core_bentley_1.ITwinError.isError(error, WorkspaceError.scope, key);
    }
    WorkspaceError.isError = isError;
    function throwError(key, e) {
        core_bentley_1.ITwinError.throwError({ ...e, iTwinErrorId: { key, scope: WorkspaceError.scope } });
    }
    WorkspaceError.throwError = throwError;
})(WorkspaceError || (exports.WorkspaceError = WorkspaceError = {}));
/** @beta */
var ChannelControlError;
(function (ChannelControlError) {
    /** the ITwinError scope for `ChannelControlError`s. */
    ChannelControlError.scope = "itwin-ChannelControl";
    /** Instantiate and throw a ChannelControlError */
    function throwError(key, message, channelKey) {
        core_bentley_1.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 core_bentley_1.ITwinError.isError(error, ChannelControlError.scope, key) && typeof error.channelKey === "string";
    }
    ChannelControlError.isError = isError;
})(ChannelControlError || (exports.ChannelControlError = ChannelControlError = {}));
//# sourceMappingURL=ITwinCoreErrors.js.map