@ritas-inc/hanaqueryapi-client
Version:
TypeScript client for HANA Query API with full type safety and error handling
82 lines • 2.56 kB
TypeScript
/**
* Error Handling Examples
*
* This file demonstrates comprehensive error handling strategies
* for the HANA Query API client.
*/
declare function basicErrorHandling(): Promise<void>;
declare function specificErrorHandling(): Promise<void>;
declare function errorTypeGuards(): Promise<void>;
declare function gracefulErrorHandling(): Promise<void>;
declare function customRetryLogic(): Promise<void>;
declare function errorContextAndDebugging(): Promise<void>;
declare class RobustAPIService {
private client;
private config;
constructor(config: {
baseUrl: string;
enableLogging?: boolean;
logLevel?: 'debug' | 'info' | 'warn' | 'error';
timeout?: number;
retries?: number;
});
/**
* Wrapper method that handles errors consistently
*/
private safeApiCall;
/**
* Convert technical errors to user-friendly messages
*/
private getUserFriendlyMessage;
/**
* Public methods with consistent error handling
*/
getHealthStatus(): Promise<{
success: false;
error: string;
type: string;
} | {
success: true;
data: {
data: import("../types.ts").HealthData;
metadata: import("../types.ts").HealthMetadata;
};
}>;
getProductionPlans(): Promise<{
success: false;
error: string;
type: string;
} | {
success: true;
data: {
data: import("../types.ts").PlansData;
metadata: import("../types.ts").PlansMetadata;
};
}>;
getPlanDetails(planId: number): Promise<{
success: false;
error: string;
type: string;
} | {
success: true;
data: {
data: import("../types.ts").SinglePlanData;
metadata: import("../types.ts").SinglePlanMetadata;
};
}>;
getInventoryStatus(): Promise<{
success: false;
error: string;
type: string;
} | {
success: true;
data: {
data: import("../types.ts").ItemsStatusData;
metadata: import("../types.ts").ItemsStatusMetadata;
};
}>;
}
declare function productionReadyErrorHandling(): Promise<void>;
declare function runErrorHandlingExamples(): Promise<void>;
export { basicErrorHandling, specificErrorHandling, errorTypeGuards, gracefulErrorHandling, customRetryLogic, errorContextAndDebugging, productionReadyErrorHandling, RobustAPIService, runErrorHandlingExamples };
//# sourceMappingURL=error-handling.d.ts.map