@reclaimprotocol/attestor-core
Version:
<div> <div> <img src="https://raw.githubusercontent.com/reclaimprotocol/.github/main/assets/banners/Attestor-Core.png" /> </div> </div>
27 lines (26 loc) • 852 B
TypeScript
import { ErrorCode, ErrorData } from '../proto/api.ts';
/**
* Represents an error that can be thrown by the Attestor Core
* or server. Provides a code, and optional data
* to pass along with the error.
*/
export declare class AttestorError extends Error {
readonly name = "AttestorError";
readonly code: keyof typeof ErrorCode;
readonly data: {
[_: string]: any;
} | undefined;
constructor(code: keyof typeof ErrorCode, message: string, data?: {
[_: string]: any;
});
/**
* Encodes the error as a ErrorData
* protobuf message
*/
toProto(): ErrorData;
static fromProto(data?: ErrorData): AttestorError;
static fromError(err: Error, code?: keyof typeof ErrorCode): AttestorError;
static badRequest(message: string, data?: {
[_: string]: any;
}): AttestorError;
}