Implement robust error handling and configuration for Logistics API interactions
- Introduced `LogisticsApiException` to handle connection and request errors with user-friendly messages in French. - Updated `LogisticsService` to include configurable timeout, connection timeout, retry attempts, and sleep duration for retries. - Enhanced error handling in Filament pages to catch `LogisticsApiException` and provide clear feedback to users. - Updated `.env` and `config/logistics.php` to support new configuration options. - Added logging for failed API requests in `api_request_logs`. - Created comprehensive API documentation for Logistics endpoints.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Tech Context
|
||||
|
||||
Derniere mise a jour : 2026-02-19
|
||||
Derniere mise a jour : 2026-02-20
|
||||
|
||||
## Stack technique
|
||||
|
||||
@@ -33,21 +33,35 @@ Derniere mise a jour : 2026-02-19
|
||||
LOGISTICS_API_BASE_URL=http://tse-10-test.esiweb.pro
|
||||
LOGISTICS_API_KEY=<cle API>
|
||||
LOGISTICS_API_FOLDER=esigescom
|
||||
LOGISTICS_API_TIMEOUT=30
|
||||
LOGISTICS_API_CONNECT_TIMEOUT=10
|
||||
LOGISTICS_API_RETRY_TIMES=3
|
||||
LOGISTICS_API_RETRY_SLEEP_MS=500
|
||||
```
|
||||
|
||||
Fichier de config : `config/logistics.php`
|
||||
|
||||
| Cle de config | Variable .env | Defaut | Description |
|
||||
|---------------|---------------|--------|-------------|
|
||||
| `logistics.base_url` | `LOGISTICS_API_BASE_URL` | - | URL de base de l'API |
|
||||
| `logistics.api_key` | `LOGISTICS_API_KEY` | - | Cle d'authentification |
|
||||
| `logistics.folder` | `LOGISTICS_API_FOLDER` | - | Dossier dans l'URL |
|
||||
| `logistics.timeout` | `LOGISTICS_API_TIMEOUT` | 30 | Timeout total de la requete (secondes) |
|
||||
| `logistics.connect_timeout` | `LOGISTICS_API_CONNECT_TIMEOUT` | 10 | Timeout de connexion (secondes) |
|
||||
| `logistics.retry.times` | `LOGISTICS_API_RETRY_TIMES` | 3 | Nombre de tentatives en cas d'echec de connexion |
|
||||
| `logistics.retry.sleep_ms` | `LOGISTICS_API_RETRY_SLEEP_MS` | 500 | Delai entre les tentatives (ms) |
|
||||
|
||||
### Base de donnees
|
||||
|
||||
- Connexion : MySQL
|
||||
- Base : `api_logistics`
|
||||
- Base : `logistics`
|
||||
- Configuration dans `.env` : `DB_CONNECTION=mysql`
|
||||
|
||||
## API Logistics
|
||||
|
||||
### Connexion
|
||||
|
||||
- Serveur : TSE-10-TEST
|
||||
- Serveur : TSE-10-TEST (reseau prive, accessible uniquement via Bureau a distance / RDP)
|
||||
- Base URL : `http://tse-10-test.esiweb.pro`
|
||||
- Dossier : `esigescom` (minuscules obligatoires)
|
||||
- Authentification : Header `X-API-KEY`
|
||||
|
||||
Reference in New Issue
Block a user