@@ -8,6 +8,7 @@ import org.gitanimals.render.domain.UserService
8
8
import org.gitanimals.render.domain.event.NewUserCreated
9
9
import org.gitanimals.render.domain.event.Visited
10
10
import org.rooftop.netx.api.SagaManager
11
+ import org.slf4j.LoggerFactory
11
12
import org.slf4j.MDC
12
13
import org.springframework.context.ApplicationEventPublisher
13
14
import org.springframework.stereotype.Service
@@ -22,6 +23,8 @@ class AnimationFacade(
22
23
private val githubOpenApi : GithubOpenApi ,
23
24
) {
24
25
26
+ private val logger = LoggerFactory .getLogger(this ::class .simpleName)
27
+
25
28
fun getFarmAnimation (username : String ): String {
26
29
return when (userService.existsByName(username)) {
27
30
true -> {
@@ -59,15 +62,19 @@ class AnimationFacade(
59
62
}
60
63
61
64
private fun setUserAuthInfoIfNotSet (username : String ) {
62
- val user = userService.getUserByName(username)
65
+ runCatching {
66
+ val user = userService.getUserByName(username)
63
67
64
- if (user.isAuthInfoSet().not ()) {
65
- val githubUserAuthInfo = githubOpenApi.getGithubUser(user.getName())
66
- userService.setAuthInfo(
67
- name = user.getName(),
68
- entryPoint = EntryPoint .GITHUB ,
69
- githubUserAuthInfo.id,
70
- )
68
+ if (user.isAuthInfoSet().not ()) {
69
+ val githubUserAuthInfo = githubOpenApi.getGithubUser(user.getName())
70
+ userService.setAuthInfo(
71
+ name = user.getName(),
72
+ entryPoint = EntryPoint .GITHUB ,
73
+ githubUserAuthInfo.id,
74
+ )
75
+ }
76
+ }.onFailure {
77
+ logger.info(" Fail to update userAuthInfo cause: ${it.message} " , it)
71
78
}
72
79
}
73
80
0 commit comments