Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

#127 Improve Error Handling for Failed DefectDojo API Requests#128

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Weltraumschaf merged 3 commits intosecureCodeBox:mainfromWeltraumschaf:issue_127
Jul 27, 2024

Conversation

Weltraumschaf
Copy link
Member

Two Problems:

  1. We do not pass consequently the causing exception to our own custom exception.
  2. We do not catch all possible REST client runtime exceptions.

Fixed by consequent logging and passing ofthe origin exception as cause of our own excpetion. Also catching a more generic exception type totach all possible errors.

…questsTwo Problems:1. We do not pass consequently the causing exception to our own custom   exception.2. We do not catch all possible REST client runtime exceptions.Fixed by consequent logging and passing ofthe origin exception ascause of our own excpetion. Also catching a more generic exceptiontype totach all possible errors.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@WeltraumschafWeltraumschaf self-assigned thisJul 12, 2024
@WeltraumschafWeltraumschaf added the enhancementNew feature or request labelJul 12, 2024

return response.getBody();
try {
ResponseEntity<T> response = restTemplate.exchange(
Copy link
Member

Choose a reason for hiding this comment

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

Did you intentionally only add this for the GET requests?
The error handling for the other http methods seems to be the same

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

🤔No. This means that any error handling is missing on non-GET bc I simply greppedHttpClientErrorException 😬


return response.getBody();
} catch (RestClientException e) {
log.error("Exception while getting data: {}", e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

Whats in a message for a request client exception?
Is that enough for users to understand what request failed? Does it include the http method and url of the request?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's a common pattern in Java that you simply log the exception message, if the exception is rethrown with the origin exception as cause because the full exception handling is done where the rethrown exception is catched. It's quite debatable if this log message is really necessary.

The conatenation will be done always, also if debug level is notlogged. So we should alwyas use parameterized log statements.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
…P MethodsIn previous commits only GET requests were covered with properexception handling.This adds rethrow of our own custom exception with the originatingerror as cause, like already implemented for GET requests.Signed-off-by: Sven Strittmatter <sven.strittmatter@iteratec.com>
@WeltraumschafWeltraumschaf merged commitc2daf60 intosecureCodeBox:mainJul 27, 2024
2 checks passed
@WeltraumschafWeltraumschaf deleted the issue_127 branchJuly 27, 2024 07:10
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@J12934J12934J12934 left review comments

@IlyesbdlalaIlyesbdlalaIlyesbdlala approved these changes

Assignees

@WeltraumschafWeltraumschaf

Labels
enhancementNew feature or request
Projects
Archived in project
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@Weltraumschaf@J12934@Ilyesbdlala

[8]ページ先頭

©2009-2025 Movatter.jp