fivesim-api
Version:
Node.js wrapper for the 5sim.net API - SMS verification service with TypeScript support
81 lines (80 loc) • 2.17 kB
TypeScript
/**
* Base class for all 5sim API errors
*/
export declare class FiveSimError extends Error {
/** HTTP status code if applicable */
status?: number;
/** Original error response */
response?: any;
constructor(message: string, status?: number, response?: any);
}
/**
* Error thrown when authentication fails
*/
export declare class AuthenticationError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when rate limits are exceeded
*/
export declare class RateLimitError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when a resource is not found
*/
export declare class NotFoundError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when there are no available phone numbers
*/
export declare class NoPhoneNumbersError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when the user has insufficient balance
*/
export declare class InsufficientBalanceError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when the user has insufficient rating
*/
export declare class InsufficientRatingError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when an invalid parameter is provided
*/
export declare class ValidationError extends FiveSimError {
constructor(message: string);
}
/**
* Error thrown when the server is unavailable
*/
export declare class ServerError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when an order has expired
*/
export declare class OrderExpiredError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when an order already has SMS
*/
export declare class OrderHasSMSError extends FiveSimError {
constructor(message?: string);
}
/**
* Error thrown when attempting operations on a hosting order that are not allowed
*/
export declare class HostingOrderError extends FiveSimError {
constructor(message?: string);
}
/**
* Helper function to create appropriate error based on API response
*/
export declare function createError(error: any): FiveSimError;