Core Utilities & Error Handling
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Core Utilities and Error Handling in the flext-oracle-oic project provide a robust foundation for interacting with Oracle Integration Cloud (OIC). This module encompasses data validation, health monitoring, and enterprise-grade error management using Railway-Oriented Programming (ROP) principles. The system ensures that all operations—from authentication to integration lifecycle management—are type-safe and resilient.
The utilities are structured as a unified class FlextOracleOicUtilities, which aggregates domain-specific functionality through mixins. This design separates concerns such as connection validation, authentication verification, and performance metric analysis, providing a single point of entry for secondary operations within the extension.
Sources: src/flext_oracle_oic/utilities.py:1-25, src/flext_oracle_oic/ext_client.py:1-20
Utility Architecture & Organization
The utility system follows the FLEXT [Project]Utilities pattern, centralizing domain logic into nested namespaces. These namespaces are composed via Method Resolution Order (MRO) from internal mixin classes.
The diagram shows how FlextOracleOicUtilities acts as a facade for specialized validation and monitoring logic.
Sources: src/flext_oracle_oic/utilities.py:30-55, src/flext_oracle_oic/_utilities/monitoring.py:11-15
Data Validation Framework
The validation logic utilizes FieldValidationPlan models to define constraints for integration metadata. This ensures that names, versions, and statuses adhere to Oracle OIC requirements before API submission.
Integration Validation Logic
Validation is performed by checking fields against regex patterns and length constraints defined in the project constants.
| Field | Validation Rule | Constant Reference |
|---|---|---|
| Integration Name | Regex: ^[a-zA-Z0-9_\-\s]+$ | INTEGRATION_NAME_RE |
| Version | Format: XX.XX.XXXX | VERSION_PATTERN |
| Status | Must be in valid status set | VALID_INTEGRATION_STATUSES |
Sources: src/flext_oracle_oic/_utilities/oracle_oic.py:48-75, src/flext_oracle_oic/constants.py:155-185
Validation Data Flow
The flow illustrates the atomic field validation process used in validate_integration_data.
Sources: src/flext_oracle_oic/_utilities/oracle_oic.py:84-110
Monitoring & Health Assessment
Monitoring utilities analyze OIC performance metrics and health status responses. The system categorizes issues into warnings and critical failures based on configurable thresholds.
Performance Thresholds
Metrics are assessed against PERFORMANCE_THRESHOLDS defined in the validation constants.
- Response Time: Threshold of 5000ms. Exceeding this triggers a warning.
- Success Rate: Minimum threshold of 95%. Falling below this is considered a critical issue.
- Error Rate: Maximum threshold of 5%. Exceeding this triggers a warning.
Sources: src/flext_oracle_oic/_utilities/monitoring.py:17-48, src/flext_oracle_oic/constants.py:186-190
Health Status Validation
The utility validates health data structure, ensuring it contains a valid status (healthy, unhealthy, error, or unknown) and correct component metadata for the database, messaging, and integration engine.
Sources: src/flext_oracle_oic/_utilities/monitoring.py:104-142, src/flext_oracle_oic/constants.py:130-145
Error Handling & Railway-Oriented Programming
The project utilizes the p.Result (or r) type to implement Railway-Oriented Programming. This approach avoids side-effect exceptions in favor of explicit success/failure containers.
API Request Lifecycle
When the FlextOracleOicClient makes a request, it follows a chain of operations that can fail at any point (e.g., token retrieval, URL validation, or network timeout).
This diagram demonstrates the flat_map pattern used in make_request to chain authenticated operations.
Sources: src/flext_oracle_oic/ext_client.py:165-195, src/flext_oracle_oic/ext_client.py:270-300
Error Constants
Specific HTTP and validation errors are handled using standardized constants to maintain consistency across the extension.
| Constant | Value / Purpose |
|---|---|
HTTP_ERROR_STATUS_THRESHOLD | 400 (Threshold for API error handling) |
EXC_NETWORK_TYPE | Type alias for network-related exceptions |
HealthStatus.ERROR | String identifier for error states in monitoring |
Sources: src/flext_oracle_oic/constants.py:145-150, src/flext_oracle_oic/ext_client.py:340-350
Summary
The Core Utilities and Error Handling module ensures that all interactions with Oracle OIC are validated and monitored. By leveraging MRO-based utility classes and Result-based error handling, the system provides a predictable and stable environment for enterprise integrations. Key validation logic ensures data integrity, while the monitoring mixin provides real-time insights into system performance and health.
Sources: src/flext_oracle_oic/utilities.py:15-28, src/flext_oracle_oic/_utilities/monitoring.py:80-100