Coverage for src/xrayradar/exceptions.py: 100%
10 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-14 15:56 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-14 15:56 +0000
1"""
2Custom exceptions for xrayradar
4All exceptions inherit from ErrorTrackerException and provide clear,
5actionable error messages to help users resolve issues quickly.
6"""
9class ErrorTrackerException(Exception):
10 """
11 Base exception for all error tracker SDK errors
13 All xrayradar-specific exceptions inherit from this class,
14 making it easy to catch all SDK-related errors.
15 """
16 pass
19class ConfigurationError(ErrorTrackerException):
20 """
21 Raised when there's a configuration error
23 This typically indicates an issue with how the SDK is configured,
24 such as an invalid DSN format or missing required parameters.
26 Example:
27 >>> raise ConfigurationError("DSN is required but not provided")
28 """
29 pass
32class TransportError(ErrorTrackerException):
33 """
34 Raised when there's an error sending data to the XrayRadar server
36 This indicates a network or server-side issue preventing event delivery.
37 The SDK will include details about the failure in the error message.
39 Example:
40 >>> raise TransportError("Failed to send event: HTTP 500: Internal Server Error")
41 """
42 pass
45class RateLimitedError(TransportError):
46 """
47 Raised when the client is rate limited by the XrayRadar server
49 The server has temporarily limited requests. The error message includes
50 the retry-after time. You should wait before sending more events.
52 Example:
53 >>> raise RateLimitedError("Rate limited. Retry after 60 seconds")
54 """
55 pass
58class InvalidDsnError(ConfigurationError):
59 """
60 Raised when the DSN (Data Source Name) is invalid or malformed
62 The DSN format should be: https://xrayradar.com/your_project_id
63 Make sure you've copied the correct DSN from your XrayRadar project settings.
65 Example:
66 >>> raise InvalidDsnError("Invalid DSN format: https://example.com")
67 """
68 pass