Last active
April 28, 2020 02:34
-
-
Save CheolhoJeon/a8fd96308077e38d38535fd3dac81785 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PostMapping("/api/members") | |
public void newMember(@RequestBody @Valid RegisterRequest regReq, Errors errors) throws IOException { | |
if (errors.hasErrors()) { | |
String errorCodes = errors | |
.getAllErrors() | |
.stream() | |
.map(error -> error.getCodes()[0]) | |
.collect(Collectors.joining(",")); | |
return ResponseEntity | |
.status(HttpStatus.BAD_REQUEST) | |
.body(new ErrorResponse("errorCodes = " + errorCodes)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment