-
Notifications
You must be signed in to change notification settings - Fork 240
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
๐ 2๋จ๊ณ - ๊นํ ๋ก๊ทธ์ธ ๊ตฌํ #613
base: beyondorder
Are you sure you want to change the base?
Conversation
์ํ๋! ๋ก๊ทธ์ธ ํ ํ์์ ๋ณด๋ฅผ ์กฐํํ๋ ์ธ์ํ
์คํธ๊ฐ ๋ณด์ด์ง ์๋ค์. ๐ญ ์์ ํ ๋ค์ ๋ฆฌ๋ทฐ ์์ฒญ ๋ถํ๋๋ฆฝ๋๋ค! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ธ์ํ
์คํธ ์๋๋ฆฌ์ค์ ๋ช๊ฐ์ง ๋น ์ง ๋ด์ฉ์ด ์๋ค์!
์ฝ๋ฉํธ ๋จ๊ฒจ๋์์ผ๋, ํ์ธํด์ฃผ์๊ณ , ๋ค์ ๋ฆฌ๋ทฐ์์ฒญ ๋ถํ๋๋ฆฝ๋๋ค. ๐
public enum GithubResponse { | ||
์ฌ์ฉ์1("code1", "accessToken1","[email protected]"), | ||
์ฌ์ฉ์2("code2", "accessToken2","[email protected]"), | ||
์ฌ์ฉ์3("code3", "accessToken3","[email protected]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fake ๊ฐ์ฒด๊ฐ main์ ์๋ค์. ๐
@@ -9,7 +10,7 @@ public class GlobalExceptionHandler { | |||
|
|||
@ExceptionHandler(IllegalArgumentException.class) | |||
public ResponseEntity<ErrorResponse> handleBadRequestException(IllegalArgumentException e) { | |||
return ResponseEntity.badRequest().body(new ErrorResponse(e.getMessage())); | |||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new ErrorResponse(e.getMessage())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ฆฌ๋ทฐ๋ฐ์ ๐ฏ
Station source = this.stationRepository.findById(request.getSource()).orElseThrow(() -> new RuntimeException("์กด์ฌํ์ง ์๋ ์ถ๋ฐ์ญ์ ๋๋ค.")); | ||
Station target = this.stationRepository.findById(request.getTarget()).orElseThrow(() -> new RuntimeException("์กด์ฌํ์ง ์๋ ๋์ฐฉ์ญ์ ๋๋ค.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exception์ ๋ฒ์๊ฐ ๋์ด์ก๋ค์. RuntimeException์ผ๋ก ๋ฐ๊พผ ์ด์ ๊ฐ ์์๊น์? ๐ค
@PostMapping("/github/access-token") | ||
public ResponseEntity<GithubAccessTokenResponse> test(@RequestBody GithubAccessTokenRequest request) { | ||
return ResponseEntity.ok(new GithubAccessTokenResponse(GithubResponse.findByCode(request.getCode()).getAccessToken())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์ธ์ํ ์คํธ์์ fake(test/github/access-token)์ ํธ์ถํ๋ ๋ถ๋ถ์ด ๋ณด์ด์ง ์์์. ์ ๊ฐ ๋ชป์ฐพ์ ๊ฑธ๊น์? ๐ค
No description provided.