diff --git a/README.md b/README.md
index 74fcb0b..a2b99cd 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@
-
+
⭐스타를 눌러주세요 개발에 큰 도움이 됩니다!⭐️
diff --git a/src/main/kotlin/org/gitanimals/render/app/Exception.kt b/src/main/kotlin/org/gitanimals/render/app/Exception.kt
new file mode 100644
index 0000000..d0eae82
--- /dev/null
+++ b/src/main/kotlin/org/gitanimals/render/app/Exception.kt
@@ -0,0 +1,6 @@
+package org.gitanimals.render.app
+
+
+class AuthorizationException(message: String) : IllegalArgumentException(message)
+
+val AUTHORIZATION_EXCEPTION = AuthorizationException("Authorization fail")
diff --git a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt
index 41a9c30..5a24e7b 100644
--- a/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt
+++ b/src/main/kotlin/org/gitanimals/render/controller/PersonaController.kt
@@ -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
@@ -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)
}
diff --git a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt
index 9b394c5..6ee94a9 100644
--- a/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt
+++ b/src/main/kotlin/org/gitanimals/render/infra/RestIdentityApi.kt
@@ -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
@@ -18,7 +19,7 @@ class RestIdentityApi : IdentityApi {
runCatching {
response.bodyTo(IdentityApi.UserResponse::class.java)
}.getOrElse {
- throw IllegalArgumentException("Unauthorized user")
+ throw AUTHORIZATION_EXCEPTION
}
}
}