//#region src/api-client/errors.d.ts
/**
 * API Error Class Hierarchy
 *
 * This module defines a hierarchical error system for the Sentry API client
 * that automatically categorizes errors based on HTTP status codes.
 *
 * Key principles:
 * - 4xx errors (ApiClientError) are user input errors, not reported to Sentry
 * - 5xx errors (ApiServerError) are system errors, reported to Sentry
 * - Specific error types provide additional context and helper methods
 * - The hierarchy enables type-safe error handling without manual status checks
 */
/**
 * Base class for all API errors.
 * Contains common properties for all API error types.
 * Status is optional since some errors (like client-side validation) don't have HTTP status codes.
 */
declare class ApiError extends Error {
  readonly status?: number | undefined;
  readonly detail?: string | undefined;
  readonly responseBody?: unknown | undefined;
  constructor(message: string, status?: number | undefined, detail?: string | undefined, responseBody?: unknown | undefined);
}
/**
 * Client errors (4xx) - User input errors that should NOT be reported to Sentry.
 * These typically indicate issues with the request that the user can fix.
 * Also includes client-side validation errors that don't have HTTP status codes.
 */
declare class ApiClientError extends ApiError {
  constructor(message: string, status?: number, detail?: string, responseBody?: unknown);
  /**
   * Convert to a user-friendly formatted message.
   * Returns the standard format: "API error (status): message" or just "API error: message" if no status.
   * For 404 errors, adds helpful context about checking parameters.
   */
  toUserMessage(): string;
  /**
   * Check if this is a permission/authorization error (403)
   */
  isPermissionError(): boolean;
  /**
   * Check if this is a not found error (404)
   */
  isNotFoundError(): boolean;
  /**
   * Check if this is a validation error (400 or 422)
   */
  isValidationError(): boolean;
  /**
   * Check if this is an authentication error (401)
   */
  isAuthenticationError(): boolean;
  /**
   * Check if this is a rate limit error (429)
   */
  isRateLimitError(): boolean;
}
/**
 * Permission denied error (403).
 * Includes special handling for multi-project access errors.
 */
declare class ApiPermissionError extends ApiClientError {
  constructor(message: string, detail?: string, responseBody?: unknown);
  /**
   * Check if this is the specific multi-project access error
   */
  isMultiProjectAccessError(): boolean;
}
/**
 * Resource not found error (404).
 * Can include additional context about what resource was not found.
 */
declare class ApiNotFoundError extends ApiClientError {
  readonly resourceType?: string | undefined;
  readonly resourceId?: string | undefined;
  constructor(message: string, detail?: string, responseBody?: unknown, resourceType?: string | undefined, resourceId?: string | undefined);
}
/**
 * Validation error (400 or 422 for API responses, or no status for client-side validation).
 * Indicates the request was malformed or contained invalid data.
 */
declare class ApiValidationError extends ApiClientError {
  readonly validationErrors?: Record<string, string[]> | undefined;
  constructor(message: string, status?: 400 | 422, detail?: string, responseBody?: unknown, validationErrors?: Record<string, string[]> | undefined);
}
/**
 * Authentication error (401).
 * Indicates the request lacks valid authentication credentials.
 */
declare class ApiAuthenticationError extends ApiClientError {
  constructor(message: string, detail?: string, responseBody?: unknown);
}
/**
 * Rate limit error (429).
 * Includes retry-after information when available.
 */
declare class ApiRateLimitError extends ApiClientError {
  readonly retryAfter?: number | undefined;
  constructor(message: string, detail?: string, responseBody?: unknown, retryAfter?: number | undefined);
}
/**
 * Server errors (5xx) - System errors that SHOULD be reported to Sentry.
 * These indicate problems with the server that are not the user's fault.
 */
declare class ApiServerError extends ApiError {
  constructor(message: string, status: number, detail?: string, responseBody?: unknown);
  /**
   * Check if this is a gateway/proxy error (502, 503, 504)
   */
  isGatewayError(): boolean;
  /**
   * Check if this is an internal server error (500)
   */
  isInternalError(): boolean;
}
/**
 * Factory function to create the appropriate error type based on HTTP status code.
 * This centralizes the logic for determining which error class to instantiate.
 * This is only used for actual API responses, so status is required.
 */
declare function createApiError(message: string, status: number, detail?: string, responseBody?: unknown): ApiError;
//# sourceMappingURL=errors.d.ts.map
//#endregion
export { ApiAuthenticationError, ApiClientError, ApiError, ApiNotFoundError, ApiPermissionError, ApiRateLimitError, ApiServerError, ApiValidationError, createApiError };
//# sourceMappingURL=errors-CyAWBU2S.d.ts.map