Skip to content

Conversation

@cbullinger
Copy link
Collaborator

@cbullinger cbullinger commented Dec 8, 2025

  • Add custom error classes (VoyageAuthError, VoyageAPIError) to distinguish error types

  • Update generateVoyageEmbedding to throw VoyageAuthError for 401 responses

  • Return 401 status for authentication errors, 503 for API errors

  • Improve client-side error handling with user-friendly messages

    image
  • Update tests to verify proper error handling for different scenarios

@cbullinger cbullinger marked this pull request as ready for review December 9, 2025 18:03
- Add custom error classes (VoyageAuthError, VoyageAPIError) to distinguish error types
- Update generateVoyageEmbedding to throw VoyageAuthError for 401 responses
- Return 401 status for authentication errors, 503 for API errors
- Improve client-side error handling with user-friendly messages
- Update tests to verify proper error handling for different scenarios
- Python FastAPI backend:
  - Created custom exception classes (VoyageAuthError, VoyageAPIError)
  - Created error response utility function
  - Added global exception handlers in main.py
  - Updated vector search endpoint to use custom exceptions
  - Returns 400 for missing API key (SERVICE_UNAVAILABLE)
  - Returns 401 for invalid API key (VOYAGE_AUTH_ERROR)
  - Returns 503 for Voyage AI API errors (VOYAGE_API_ERROR)
  - Updated test to match new error handling behavior

- Java Spring backend:
  - Created custom exception classes (VoyageAuthException, VoyageAPIException, ServiceUnavailableException)
  - Updated GlobalExceptionHandler with handlers for new exceptions
  - Updated MovieServiceImpl to throw custom exceptions
  - Returns 400 for missing API key (SERVICE_UNAVAILABLE)
  - Returns 401 for invalid API key (VOYAGE_AUTH_ERROR)
  - Returns 503 for Voyage AI API errors (VOYAGE_API_ERROR)
  - Updated tests to expect ServiceUnavailableException instead of ValidationException

All three backends (Express, Python, Java) now have consistent Voyage AI error handling.
Replace datetime.utcnow() with datetime.now(timezone.utc) to fix deprecation warning in Python 3.12+.
@cbullinger cbullinger force-pushed the docsp-55531-voyage-api-error-handling branch from e4fa015 to 695161c Compare December 12, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants