pub fn map_api_error<T>(err: Error<T>) -> Error
Helper to map API errors to appropriate error types based on status code