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

feat: make rest api return error details on edc exceptions and validation error by default #1729

Merged
merged 1 commit into from
Jul 25, 2022
Merged

feat: make rest api return error details on edc exceptions and validation error by default #1729

merged 1 commit into from
Jul 25, 2022

Conversation

ndr-brt
Copy link
Member

@ndr-brt ndr-brt commented Jul 22, 2022

What this PR changes/adds

Return the "api error detail" response payload by default

Why it does that

The clients should be aware of the failure reason.

Further notes

  • having the possibility to include the stacktrace as it was hinted in the issue didn't seem a good idea, clients should only be aware of errors resolvable on their side, and the stacktrace won't help them at all, neither in a development environment
  • Removed the "verbose" config settings as it has lost its value.

Linked Issue(s)

Closes #1492

Checklist

  • added appropriate tests?
  • performed checkstyle check locally?
  • added/updated copyright headers?
  • documented public classes/methods?
  • added/updated relevant documentation?
  • added relevant details to the changelog? (skip with label no-changelog)
  • formatted title correctly? (take a look at the CONTRIBUTING and styleguide for details)

@codecov-commenter
Copy link

Codecov Report

Merging #1729 (d0de197) into main (56a8d08) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1729      +/-   ##
==========================================
- Coverage   67.39%   67.39%   -0.01%     
==========================================
  Files         802      802              
  Lines       17185    17182       -3     
  Branches     1101     1100       -1     
==========================================
- Hits        11582    11579       -3     
  Misses       5124     5124              
  Partials      479      479              
Impacted Files Coverage Δ
...onnector/extension/jersey/JerseyConfiguration.java 100.00% <ø> (ø)
...econnector/extension/jersey/JerseyRestService.java 94.28% <100.00%> (-0.31%) ⬇️
...extension/jersey/mapper/EdcApiExceptionMapper.java 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56a8d08...d0de197. Read the comment docs.

@ndr-brt ndr-brt requested a review from ronjaquensel July 22, 2022 10:21

return Response.status(status)
.entity(List.of(errorDetail))
.build();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily related to this PR. But we do not provide the error details (in the entity part of the Response) is the exception is not of type EdcApiException

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bscholtes1A I think this is correct, as the other exceptions should cause a 5xx error (a server fault, so the client won't need any detail).
I added an issue on this topic: #1730

@ndr-brt ndr-brt merged commit 9e037d2 into eclipse-edc:main Jul 25, 2022
@ndr-brt ndr-brt deleted the feature/1492-return-validation-error-by-default branch July 25, 2022 07:19
diegogomez-zf pushed a commit to diegogomez-zf/DataSpaceConnector that referenced this pull request Aug 3, 2022
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.

api: return validation error message by default
5 participants