-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
38 lines (22 loc) · 984 Bytes
/
Copy pathexceptions.py
File metadata and controls
38 lines (22 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Custom exceptions for the French Companies API Client.
This module defines all custom exceptions used throughout the API client.
"""
class ApiClientError(Exception):
"""Base exception for all API client errors."""
class AuthenticationError(ApiClientError):
"""Raised when authentication fails."""
class ValidationError(ApiClientError):
"""Raised when input validation fails."""
class DataNotFoundError(ApiClientError):
"""Raised when expected data is not found in API response."""
class ApiRequestError(ApiClientError):
"""Raised when an API request fails."""
def __init__(self, message: str, status_code: int = None, response_text: str = None):
super().__init__(message)
self.status_code = status_code
self.response_text = response_text
class InvalidSirenError(ValidationError):
"""Raised when SIREN format is invalid."""
class InvalidSiretError(ValidationError):
"""Raised when SIRET format is invalid."""