Error Handling
Discover how to handle errors and exceptions in this section. It covers common error scenarios, how to catch and respond to errors, and best practices for ensuring robust and resilient code.
The Fi AI Client employs a robust error-handling mechanism, raising specific exceptions for different types of errors encountered during operation. This ensures that issues are clearly identified and can be addressed promptly, enhancing the reliability and maintainability of your integration. Below is a detailed explanation of each key exception and its usage:
1. AuthError
Description: Raised if the API key or secret key is missing or invalid. This error occurs when the client attempts to authenticate with the Fi AI service but fails due to incorrect or absent credentials.
2. InvalidAdditionalHeaders
Description: Raised if there are conflicting or invalid additional headers. This error occurs when the client is initialized with additional headers that are either incorrectly formatted or conflict with required headers.
3. InvalidValueType
Description: Raised if a parameter has an invalid type. This error ensures that all provided parameters meet the expected data types, preventing issues during data processing and logging.
4. InvalidSupportedType
Description: Raised if a model type is not supported. This error ensures that only valid model types are used, preventing issues related to unsupported model types.
5. MissingRequiredKey
Description: Raised if a required key is missing from the provided parameters. This error ensures that all necessary information is included, preventing incomplete data submissions.
6. InvalidVectorLength
Description: Raised if the vector length is invalid. This error ensures that any vector data provided meets the required length specifications, preventing issues during processing.
Summary
By raising specific exceptions for different types of errors, the Fi AI Client ensures that issues can be clearly identified and addressed promptly. This error-handling mechanism helps maintain the reliability and integrity of your integration, providing clear feedback and preventing common issues from causing major disruptions.
Last updated