UNPKG

@follow-app/client-sdk

Version:

TypeScript client SDK for Follow RSS Server API

55 lines (51 loc) 1.19 kB
/** * Base error class for all Follow API errors */ export class FollowAPIError extends Error { constructor( message: string, public status: number, public code?: string, public data?: any, ) { super(message) this.name = "FollowAPIError" } } export class NetworkError extends Error { constructor(message: string) { super(message) this.name = "NetworkError" } } /** * Authentication error for Follow API */ export class FollowAuthError extends FollowAPIError { constructor(message = "Authentication required", data?: any) { super(message, 401, "AUTH_REQUIRED", data) this.name = "FollowAuthError" } } /** * Validation error for Follow API requests */ export class FollowValidationError extends FollowAPIError { constructor( message: string, public validationErrors: any[], ) { super(message, 400, "VALIDATION_ERROR") this.name = "FollowValidationError" this.data = validationErrors } } /** * Network timeout error */ export class FollowTimeoutError extends FollowAPIError { constructor(message = "Request timeout") { super(message, 408, "TIMEOUT_ERROR") this.name = "FollowTimeoutError" } }