Fehlertypen
APIErrorResponse
interface APIErrorResponse { success: false; code: string; message: string; errors?: Array<{ field: string; code: string; message: string; }>;}ErrorCode
type ErrorCode = | 'MISSING_API_KEY' | 'INVALID_API_KEY' | 'EXPIRED_API_KEY' | 'REVOKED_API_KEY' | 'INSUFFICIENT_SCOPE' | 'IP_NOT_ALLOWED' | 'RATE_LIMIT_EXCEEDED' | 'DOCUMENT_NOT_FOUND' | 'RESOURCE_NOT_FOUND' | 'INVALID_REQUEST' | 'INVALID_PARAMETER' | 'EXPORT_LIMIT_EXCEEDED' | 'EXPORT_SIZE_EXCEEDED' | 'EXPORT_NO_FILES' | 'INTERNAL_ERROR';Fehlerklassen
SonarSDKError
Basis-Fehlerklasse für alle SDK-Fehler.
class SonarSDKError extends Error { code: ErrorCode | string; status?: number; requestId?: string; details?: Record<string, unknown>; errors?: Array<{ field: string; code: string; message: string }>; timestamp: string; toJSON(): object;}AuthenticationError
Wird bei Authentifizierungs- und Autorisierungsfehlern ausgelöst (HTTP 401/403). Erweitert SonarSDKError.
RateLimitError
Wird ausgelöst, wenn das API-Ratenlimit überschritten wird (HTTP 429). Erweitert SonarSDKError.
class RateLimitError extends SonarSDKError { retryAfter?: number;}DocumentNotFoundError
Wird ausgelöst, wenn ein angefordertes Dokument nicht existiert (HTTP 404). Erweitert SonarSDKError.
class DocumentNotFoundError extends SonarSDKError { documentId: string;}ValidationError
Wird bei client- oder serverseitigen Validierungsfehlern ausgelöst (HTTP 400). Erweitert SonarSDKError.
Vollständige Exporte
Alles, was von @sonar/sdk exportiert wird:
// Haupt-Clientexport { SonarSDK } from './client';
// Konfigurationexport type { SonarSDKConfig } from './types/config';
// Dokumenttypenexport type { Document, DocumentSignature, DocumentClassification, SignatureType, ListDocumentsParams, ListDocumentsResponse, ExportDocumentsParams, UploadDocumentParams, DocumentUploadSource, DownloadResponse, DownloadUrlParams, DownloadUrlResponse, DeleteDocumentResponse, BatchDeleteParams, BatchDeleteResponse, ScopeAction, SignatureChainDocument, SignatureChain,} from './types/documents';
// Bereichstypen & Konstantenexport { Scope } from './types/scopes';export type { AllowedScopesResponse, ScopeValue, ScopeCategory, ScopeType, ScopeEntry,} from './types/scopes';
// Fehlertypenexport type { APIErrorResponse, ErrorCode } from './types/errors';
// Fehlerklassenexport { SonarSDKError, AuthenticationError, RateLimitError, DocumentNotFoundError, ValidationError,} from './utils/errors';