Skip to content

fix(http-client): surface SAP OData error body in HttpRequestError#6624

Closed
m-zandi wants to merge 1 commit into
SAP:mainfrom
m-zandi:fix/http-client-error-body-extraction
Closed

fix(http-client): surface SAP OData error body in HttpRequestError#6624
m-zandi wants to merge 1 commit into
SAP:mainfrom
m-zandi:fix/http-client-error-body-extraction

Conversation

@m-zandi
Copy link
Copy Markdown

@m-zandi m-zandi commented May 24, 2026

What this PR does

Fixes silent loss of SAP OData/REST error response bodies when
executeHttpRequest() encounters a non-2xx HTTP status.

Problem

When SAP APIs return structured error bodies (OData v2/v4 envelopes),
the error information was silently discarded. Callers received a raw
Axios error with no access to the SAP error code or message.

Solution

  • New HttpRequestError class exposes: statusCode, responseBody, cause
  • Automatically extracts the human-readable message from OData error
    envelopes ({ error: { message: { value: "..." } } })
  • executeHttpRequest wraps Axios errors with HttpRequestError when a
    response is present; network/timeout errors are re-thrown unchanged

Breaking changes

None. HttpRequestError extends Error, so existing catch(e) blocks
continue to work. The new class is purely additive.

Checklist

  • Unit tests added
  • Changeset entry added (patch)
  • Existing tests pass
  • Types exported from public API
  • Conventional commit message

@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented May 24, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@davidkna-sap
Copy link
Copy Markdown
Member

Thank you for the PR. The implementation of this PR does not seem to be complete and does not appear to fully match the description, as such I am closing the PR. Please feel free to open an issue to discuss any changes you wish to make.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants