Improper error code translation for dependent OSDU service failures

Abhishek Patil
2026-03-27T12:46:55Z

**Current Behavior:**

The handle_core_services_http_status_error decorator in [error_handlers.py](https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/rock-and-fluid-sample/rafs-ddms-services/-/blob/main/app/services/error_handlers.py#L70) translates all unexpected errors from dependent OSDU services into HTTP 424 Failed Dependency, regardless of the original error type.

**The Problem:**

```
if status_error.response.status_code not in expected_codes:
raise OsduApiException(
status_code=status.HTTP_424_FAILED_DEPENDENCY, # Always 424
detail=json.dumps(reason),
)
```

**Example Scenario:**

1. User makes request to RAFS-DDMS service
2. RAFS-DDMS calls dependent OSDU Storage service
3. Storage service returns 500 Internal Server Error (server crash, database down, etc.)
4. RAFS-DDMS catches this and returns 424 Failed Dependency to user

**Why This Is Problematic:**

| Original Error | Current Response | Should Be | Reasoning |
|---------------------------|-----------------------|--------------------------------------------|------------------------------------|
| 500 Internal Server Error | 424 Failed Dependency | Some 5xx Service Error/Unavailable | Indicates upstream service failure |

**Impact:**

- Misleading diagnostics: 424 suggests a dependency relationship issue, not an infrastructure/server failure
- Client confusion: Clients can't distinguish between dependency configuration issues vs. service outages