@wioex/stream-sdk
Version:
WebSocket streaming SDK for real-time WioEX market data
102 lines • 2.74 kB
TypeScript
/**
* WioEX Stream SDK - Error Reporter
*
* Handles error reporting to WioEX API with batching and rate limiting
*/
import type { ErrorReportingLevel, ErrorContext } from './types.js';
import { type ErrorQueueConfig } from './utils/ErrorQueue.js';
/**
* Config interface for error reporter (flexible for internal use)
*/
interface ErrorReporterConfig {
apiKey?: string;
token?: string;
errorReportingLevel?: ErrorReportingLevel;
errorReportingUrl?: string | undefined;
includeMessageData?: boolean | undefined;
includeConnectionData?: boolean | undefined;
errorQueue?: ErrorQueueConfig | undefined;
debug?: boolean;
}
/**
* Error Reporter for WioEX Stream SDK
*
* Reports errors to WioEX API for monitoring and debugging
* Uses batching and rate limiting for optimal performance
*/
export declare class ErrorReporter {
private readonly config;
private readonly errorReportingUrl;
private readonly sdkVersion;
private readonly errorQueue;
private apiKeyHash;
private readonly logger;
constructor(config: ErrorReporterConfig);
/**
* Report an error to WioEX API (uses queue for batching)
*/
report(error: Error, context?: ErrorContext): Promise<void>;
/**
* Flush error queue immediately (useful before disconnect)
*/
flush(): Promise<void>;
/**
* Destroy error reporter and cleanup resources
*/
destroy(): void;
/**
* Build error report payload
*/
private buildErrorPayload;
/**
* Sanitize stack trace based on reporting level
*/
private sanitizeStackTrace;
/**
* Sanitize file paths in error messages/stack traces
*/
private sanitizePath;
/**
* Sanitize context data based on reporting level
*/
private sanitizeContext;
/**
* Sanitize message data
*/
private sanitizeMessageData;
/**
* Sanitize generic value
*/
private sanitizeValue;
/**
* Truncate string to maximum length
*/
private truncateString;
/**
* Get API key identification (cached for performance)
*/
private getApiKeyIdentification;
/**
* Synchronous hash function for API key identification
*/
private syncHashApiKey;
/**
* Get runtime environment information
*/
private getRuntime;
/**
* Send batch of errors to WioEX API
* Note: Sends errors individually since batch endpoint is not yet available
*/
private sendErrorBatch;
/**
* Send error using Node.js https module
*/
private sendWithHttps;
/**
* Check if debug mode is enabled
*/
private isDebugMode;
}
export {};
//# sourceMappingURL=ErrorReporter.d.ts.map