"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ERR_LOCK_INVALIDATED = exports.ERR_LOCK_IS_LOCKED = exports.ERR_LOCK_REQUEST_EXISTS = exports.ERR_NOT_ENTERED_SPACE = exports.ERR_SPACE_NAME_MISSING = exports.ErrorInfo = void 0;
// TODO: export ErrorInfo from ably-js and use that instead.
class ErrorInfo extends Error {
    constructor({ message, code, statusCode }) {
        super(message);
        if (typeof Object.setPrototypeOf !== 'undefined') {
            Object.setPrototypeOf(this, ErrorInfo.prototype);
        }
        this.code = code;
        this.statusCode = statusCode;
    }
}
exports.ErrorInfo = ErrorInfo;
const ERR_SPACE_NAME_MISSING = () => new ErrorInfo({
    message: 'must have a non-empty name for the space',
    code: 101000,
    statusCode: 400,
});
exports.ERR_SPACE_NAME_MISSING = ERR_SPACE_NAME_MISSING;
const ERR_NOT_ENTERED_SPACE = () => new ErrorInfo({
    message: 'must enter a space to perform this operation',
    code: 101001,
    statusCode: 400,
});
exports.ERR_NOT_ENTERED_SPACE = ERR_NOT_ENTERED_SPACE;
const ERR_LOCK_REQUEST_EXISTS = () => new ErrorInfo({
    message: 'lock request already exists',
    code: 101002,
    statusCode: 400,
});
exports.ERR_LOCK_REQUEST_EXISTS = ERR_LOCK_REQUEST_EXISTS;
const ERR_LOCK_IS_LOCKED = () => new ErrorInfo({
    message: 'lock is currently locked',
    code: 101003,
    statusCode: 400,
});
exports.ERR_LOCK_IS_LOCKED = ERR_LOCK_IS_LOCKED;
const ERR_LOCK_INVALIDATED = () => new ErrorInfo({
    message: 'lock was invalidated by a concurrent lock request which now holds the lock',
    code: 101004,
    statusCode: 400,
});
exports.ERR_LOCK_INVALIDATED = ERR_LOCK_INVALIDATED;
//# sourceMappingURL=Errors.js.map