Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] More detailed error feedback from accounts API #92

Open
sdischer-sap opened this issue Jan 6, 2025 · 0 comments
Open

[FEATURE] More detailed error feedback from accounts API #92

sdischer-sap opened this issue Jan 6, 2025 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sdischer-sap
Copy link
Member

sdischer-sap commented Jan 6, 2025

Is your feature request related to a problem? Please describe.
We found an unexpected case in the accounts API. If the displayName contains a / the POST request will fail and the provider will show an error event like this: API Error: Request payload is invalid, Code 11000. What exactly was the problem we could only find by debugging the issue in dev mode. The raw response from the API contained more details on what the issue exactly is.

Describe the solution you'd like
Reflect that more precise error in the responses as well. See snippet below for how the structure exactly is.
Make sure the implementation is able to use the additional details where specified, but falls back to a more general error otherwise. Needs to be tested with other known errors like 409 for naming conflicts to make sure old errors properly convert as well. Also ideally this solution should be applied to any accounts api request where it can be expected (not just POST).

Additional context
Example raw response:

{
  "error" : {
    "code" : 11000,
    "message" : "Request payload is invalid",
    "target" : "/accounts/v1/subaccounts",
    "correlationID" : "bb8d3f4b-c9f8-4126-4813-8265e34d687a",
    "details" : [ {
      "code" : 11001,
      "message" : "displayName: Display name can't contain / "
    } ]
  }
}

We can't know for sure, but this details section in the response probably is new. Ideally we should use this occasion to raise a support ticket to update the documentation to reflect the proper schema: https://api.sap.com/api/APIAccountsService/path/createSubaccount
The details is contained there, but the overall structure is incorrect, which we internally modified in the generated client to compensate for that.

@sdischer-sap sdischer-sap added enhancement New feature or request help wanted Extra attention is needed labels Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant