
Merge branch 'enhance/timeout-message' into 'next'
from pull-request 1561 * refs/heads/enhance/timeout-message: Show appropriate message when database timeout occurs Reviewed-by: 백기선
@9297ff067e412d54911187f50aa5e4dfcb07ffb9
--- app/Global.java
+++ app/Global.java
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 |
import views.html.welcome.secret; |
46 | 46 |
|
47 | 47 |
import javax.annotation.Nonnull; |
48 |
+import javax.persistence.PersistenceException; |
|
48 | 49 |
import java.io.File; |
49 | 50 |
import java.io.IOException; |
50 | 51 |
import java.io.InputStream; |
... | ... | @@ -303,7 +304,13 @@ |
303 | 304 |
AccessLogger.log(request, null, Http.Status.INTERNAL_SERVER_ERROR); |
304 | 305 |
|
305 | 306 |
if (Play.isProd()) { |
306 |
- return Promise.pure((Result) Results.internalServerError(views.html.error.internalServerError_default.render("error.internalServerError"))); |
|
307 |
+ String messageKey; |
|
308 |
+ if (t.getCause() instanceof PersistenceException && StringUtils.contains(t.getMessage(), "timed out")){ |
|
309 |
+ messageKey = "error.timeout"; |
|
310 |
+ } else { |
|
311 |
+ messageKey = "error.internalServerError"; |
|
312 |
+ } |
|
313 |
+ return Promise.pure((Result) Results.internalServerError(views.html.error.internalServerError_default.render(messageKey))); |
|
307 | 314 |
} else { |
308 | 315 |
return super.onError(request, t); |
309 | 316 |
} |
--- conf/messages
+++ conf/messages
... | ... | @@ -193,6 +193,7 @@ |
193 | 193 |
error.failedTo = Failed to {0}<br>({1} {2}) |
194 | 194 |
error.forbidden = You are not authorized |
195 | 195 |
error.forbidden.or.notfound = Project not exists or unauthorized user |
196 |
+error.timeout = Your request could not be processed because of server timeout |
|
196 | 197 |
error.internalServerError = Server error has occurred; service is not available |
197 | 198 |
error.notfound = Page not found |
198 | 199 |
error.notfound.board_post = Post not exists |
--- conf/messages.ko-KR
+++ conf/messages.ko-KR
... | ... | @@ -193,6 +193,7 @@ |
193 | 193 |
error.failedTo = {0}에 실패했습니다.<br>({1} {2}) |
194 | 194 |
error.forbidden = 권한이 없습니다 |
195 | 195 |
error.forbidden.or.notfound = 권한이 없거나 존재하지 않는 프로젝트입니다. |
196 |
+error.timeout = 요청 처리가 너무 오래 걸려 중단되었습니다 |
|
196 | 197 |
error.internalServerError = 서버 오류가 발생하여 서비스를 이용할 수 없습니다 |
197 | 198 |
error.notfound = 페이지를 찾을 수 없습니다 |
198 | 199 |
error.notfound.board_post = 존재하지 않는 글입니다 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?