import { matchRellErrorString } from "../formatter";
export class TxRejectedError extends Error {
    constructor(rejectReason) {
        super(`Transaction was rejected, ${rejectReason}`);
        this.name = "TxRejectedError";
        this.fullReason = rejectReason;
        const result = matchRellErrorString(rejectReason);
        this.shortReason = result.shortReason;
        this.rellLine = result.rellLine;
        this.operation = result.operation;
    }
}
export class UnexpectedStatusError extends Error {
    constructor(status, error) {
        let errorMessage = `Unexpected status code from server. Code: ${status}.`;
        if (error) {
            errorMessage += ` Message: ${error}.`;
        }
        super(errorMessage);
    }
}
export class LostMessageError extends Error {
    constructor() {
        super(`Server lost our message`);
    }
}
export class UnexpectedResponseError extends Error {
    constructor() {
        super(`got unexpected response from server`);
    }
}
export class UnvalidTxRidException extends Error {
    constructor(txRID) {
        super(`expected length 32 of txRID, but got ${txRID.length}`);
    }
}
export class SerializedTransactionFormatException extends Error {
    constructor() {
        super(`messageHash is not a Buffer`);
    }
}
export class GetBridFromChainException extends Error {
    constructor(chainId, reason) {
        super(`Error resolving BRID for chainId ${chainId}, reason: ${reason}`);
    }
}
export class EmptyListOfUrlsException extends Error {
    constructor() {
        super(`Failed to initialize rest client with empty list of urls`);
    }
}
export class InvalidBlochchainRIDException extends Error {
    constructor() {
        super(`Failed to initialize rest client with blockchain RID that is not 32 bytes`);
    }
}
//# sourceMappingURL=errors.js.map