Skip to content

Dev exception handler class#414

Open
Hajarel-moukh wants to merge 7 commits intomainfrom
devExceptionHandlerClass
Open

Dev exception handler class#414
Hajarel-moukh wants to merge 7 commits intomainfrom
devExceptionHandlerClass

Conversation

@Hajarel-moukh
Copy link
Copy Markdown
Contributor

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

dataProcessingContextApiPort.saveContext(partitionId, withReview);
}catch (GenesisException e){
return new ResponseEntity<>(e.getMessage(), HttpStatusCode.valueOf(e.getStatus()));
return new ResponseEntity<>(e.getMessage(), e.getStatus());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: utiliser le nouveau exceptionHandler

} catch (GenesisException e) {
return ResponseEntity.status(e.getStatus()).body(e.getMessage());
} catch (QuestionnaireNotFoundException e) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(e.getMessage());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: faire un exceptionHandler ou throw un GenesisException

return ResponseEntity.ok("File split");
}

//TODO
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TODO ?

.body(exception.getMessage());
}

@ExceptionHandler(QuestionnaireNotFoundException.class)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: créer un exceptionHandler dédié par Exception ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

J’ai choisi de les regrouper dans un seul advice pour centraliser la gestion REST, mais je peux aussi les découper par domaine si c'est mieux

}

@ExceptionHandler(NoDataException.class)
public ResponseEntity<String> handleNoData(NoDataException exception) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

idem

if (!isFolderPresent(contextualFolderPath)) {
Files.createDirectories(Path.of(contextualFolderPath));
log.debug("contextual folder created : {}", contextualFolderPath);
} else {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: remove else and use return;

@sonarqubecloud
Copy link
Copy Markdown

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