import { Error as grpcWebError } from 'grpc-web'; /** * Types of errors that originate from ILP. */ export declare enum IlpErrorType { AccountNotFound = 0, Internal = 1, InvalidAccessToken = 2, InvalidArgument = 3, Unauthenticated = 4, Unknown = 5 } /** * Represents errors thrown by ILP components of the Xpring SDK. */ export default class IlpError extends Error { readonly errorType: IlpErrorType; /** * Default errors. */ static accountNotFound: IlpError; static internal: IlpError; static invalidAccessToken: IlpError; static invalidArgument: IlpError; static unauthenticated: IlpError; static unknown: IlpError; /** * Public constructor. * * @param errorType The type of error. * @param message The error message. */ constructor(errorType: IlpErrorType, message?: string | undefined); /** * Handle an Error thrown from an Ilp network client call by translating it to * a IlpError. * * gRPC services follow return an error with a status code, so we need to map gRPC error status * to native IlpErrors. GrpcNetworkClient and GrpcNetworkClientWeb also sometimes throw * a IlpError, so we need to handle that case in here as well. * * @param error Any error returned by a network call. * @return A {@link IlpError} that has been translated from a gRPC error, or which should be rethrown */ static from(error: grpcWebError | IlpError): IlpError; }