Skip to content

Commit

Permalink
release: 0.5.6 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
devxb authored May 17, 2024
2 parents 69f8f7b + 5276fc5 commit 8243dec
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ENGLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div align = "center">
<a href="https://github.com/devxb/gitanimals">
<img src="https://render.gitanimals.org/lines/devxb?pet-id=8" width="1000" height="150"/>
<img src="https://render.gitanimals.org/lines/devxb?pet-id=23" width="1000" height="100"/>
</a>

⭐️ Please press the star! It greatly helps development! ⭐️<br>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div align = "center">
<a href="https://github.com/devxb/gitanimals">
<img src="https://render.gitanimals.org/lines/devxb?pet-id=8" width="1000" height="150"/>
<img src="https://render.gitanimals.org/lines/devxb?pet-id=23" width="1000" height="100"/>
</a>

⭐스타를 눌러주세요 개발에 큰 도움이 됩니다!⭐️<br>
Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/org/gitanimals/render/app/Exception.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.gitanimals.render.app


class AuthorizationException(message: String) : IllegalArgumentException(message)

val AUTHORIZATION_EXCEPTION = AuthorizationException("Authorization fail")
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.gitanimals.render.controller

import org.gitanimals.render.app.AuthorizationException
import org.gitanimals.render.app.UserFacade
import org.gitanimals.render.controller.request.AddPersonaRequest
import org.gitanimals.render.controller.response.ErrorResponse
Expand Down Expand Up @@ -79,4 +80,9 @@ class PersonaController(
@ResponseStatus(HttpStatus.BAD_REQUEST)
fun handleIllegalArgumentException(exception: IllegalArgumentException): ErrorResponse =
ErrorResponse.from(exception)

@ExceptionHandler(AuthorizationException::class)
@ResponseStatus(HttpStatus.UNAUTHORIZED)
fun handleAuthorizationException(exception: AuthorizationException): ErrorResponse =
ErrorResponse.from(exception)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.gitanimals.render.infra

import org.gitanimals.render.app.AUTHORIZATION_EXCEPTION
import org.gitanimals.render.app.IdentityApi
import org.springframework.http.HttpHeaders
import org.springframework.stereotype.Component
Expand All @@ -18,7 +19,7 @@ class RestIdentityApi : IdentityApi {
runCatching {
response.bodyTo(IdentityApi.UserResponse::class.java)
}.getOrElse {
throw IllegalArgumentException("Unauthorized user")
throw AUTHORIZATION_EXCEPTION
}
}
}
Expand Down

0 comments on commit 8243dec

Please sign in to comment.