sec-edgar-toolkit
Version:
Open source toolkit to facilitate working with the SEC EDGAR database
156 lines • 5.19 kB
TypeScript
/**
* Comprehensive error classes for SEC EDGAR Toolkit
*
* This module provides a rich hierarchy of error classes for better
* error handling and debugging throughout the TypeScript SDK.
*/
import { SecEdgarApiError } from './base';
/**
* Configuration errors
*/
export declare class ConfigurationError extends SecEdgarApiError {
field?: string | undefined;
constructor(message: string, field?: string | undefined);
}
export declare class InvalidUserAgentError extends ConfigurationError {
constructor(userAgent?: string);
}
/**
* API request errors
*/
export declare class RequestError extends SecEdgarApiError {
url?: string | undefined;
statusCode?: number | undefined;
response?: any | undefined;
constructor(message: string, url?: string | undefined, statusCode?: number | undefined, response?: any | undefined);
}
export declare class TimeoutError extends RequestError {
constructor(url: string, timeout: number);
}
export declare class NetworkError extends RequestError {
originalError?: Error | undefined;
constructor(message: string, url?: string, originalError?: Error | undefined);
}
/**
* Data validation errors
*/
export declare class ValidationError extends SecEdgarApiError {
field?: string | undefined;
value?: any | undefined;
constructor(message: string, field?: string | undefined, value?: any | undefined);
}
export declare class InvalidCIKError extends ValidationError {
constructor(cik: string | number);
}
export declare class InvalidDateError extends ValidationError {
constructor(date: string, expectedFormat?: string);
}
export declare class InvalidFormTypeError extends ValidationError {
constructor(formType: string, validTypes?: string[]);
}
/**
* Company lookup errors
*/
export declare class CompanyNotFoundError extends SecEdgarApiError {
identifier: string | number;
searchType: 'ticker' | 'cik' | 'name';
constructor(identifier: string | number, searchType: 'ticker' | 'cik' | 'name');
}
export declare class MultipleCompaniesFoundError extends SecEdgarApiError {
identifier: string;
count: number;
constructor(identifier: string, count: number);
}
/**
* Filing errors
*/
export declare class FilingNotFoundError extends SecEdgarApiError {
accessionNumber: string;
cik?: string | undefined;
constructor(accessionNumber: string, cik?: string | undefined);
}
export declare class FilingContentError extends SecEdgarApiError {
accessionNumber: string;
contentType?: string | undefined;
constructor(message: string, accessionNumber: string, contentType?: string | undefined);
}
/**
* Parsing errors
*/
export declare class ParsingError extends SecEdgarApiError {
documentType?: string | undefined;
section?: string | undefined;
originalError?: Error | undefined;
constructor(message: string, documentType?: string | undefined, section?: string | undefined, originalError?: Error | undefined);
}
export declare class XMLParsingError extends ParsingError {
lineNumber?: number | undefined;
columnNumber?: number | undefined;
constructor(message: string, lineNumber?: number | undefined, columnNumber?: number | undefined);
}
export declare class JSONParsingError extends ParsingError {
json?: string | undefined;
constructor(message: string, json?: string | undefined);
}
/**
* XBRL-specific errors
*/
export declare class XBRLError extends SecEdgarApiError {
concept?: string | undefined;
taxonomy?: string | undefined;
constructor(message: string, concept?: string | undefined, taxonomy?: string | undefined);
}
export declare class ConceptNotFoundError extends XBRLError {
constructor(concept: string, taxonomy?: string);
}
export declare class InvalidUnitError extends XBRLError {
constructor(unit: string, validUnits?: string[]);
}
/**
* Cache errors
*/
export declare class CacheError extends SecEdgarApiError {
operation?: string | undefined;
constructor(message: string, operation?: string | undefined);
}
/**
* Error utilities
*/
export interface ErrorContext {
operation?: string;
url?: string;
cik?: string;
ticker?: string;
formType?: string;
accessionNumber?: string;
[key: string]: any;
}
export declare class ErrorWithContext extends SecEdgarApiError {
context: ErrorContext;
originalError?: Error | undefined;
constructor(message: string, context: ErrorContext, originalError?: Error | undefined);
toString(): string;
}
/**
* Error handler utility
*/
export declare class ErrorHandler {
/**
* Wrap an error with additional context
*/
static wrapError(error: Error, context: ErrorContext, message?: string): ErrorWithContext;
/**
* Convert unknown errors to SecEdgarApiError
*/
static normalize(error: unknown): SecEdgarApiError;
/**
* Check if error is retryable
*/
static isRetryable(error: Error): boolean;
/**
* Get retry delay for an error
*/
static getRetryDelay(error: Error, attempt: number): number;
}
export { SecEdgarApiError, AuthenticationError, NotFoundError } from './base';
//# sourceMappingURL=errors.d.ts.map