From 0f1695c2df8145fd355243f2972ae457e9d6ba0b Mon Sep 17 00:00:00 2001
From: wayne <wayne8692wayne8692@gmail.com>
Date: 星期一, 29 十一月 2021 19:57:41 +0800
Subject: [PATCH] [update] 調整EService的錯誤回覆代碼與訊息規格

---
 pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java b/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
index a23c399..0a3db3b 100644
--- a/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
+++ b/pamapi/src/main/java/com/pollex/pam/security/provider/EServiceAuthenticationProvider.java
@@ -8,6 +8,7 @@
 import com.pollex.pam.security.token.EServiceAuthenticationToken;
 import com.pollex.pam.service.LoginRecordService;
 import com.pollex.pam.service.dto.EServiceResponse;
+import com.pollex.pam.web.rest.errors.EServiceErrorException;
 import org.apache.http.conn.ssl.NoopHostnameVerifier;
 import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
 import org.apache.http.impl.client.CloseableHttpClient;
@@ -74,15 +75,15 @@
                 }
                 else {
                     loginRecordService.saveEServiceLoginFailRecord(account, eServiceResponse.getMsg());
-                    throw new RuntimeException("eService login failed, eService response code = " + eServiceResponse.getCode() + ", eService response msg = " + eServiceResponse.getMsg());
+                    throw new EServiceErrorException(eServiceResponse.getMsg());
                 }
             }
 
             throw new RuntimeException("eService http error!, response http status code = " + responseEntity.getStatusCode());
         } catch (JsonProcessingException e) {
-            throw new AuthenticationServiceException("convert to json processing error!");
+            throw new RuntimeException("convert to json processing error!");
         } catch (GeneralSecurityException e) {
-            throw new AuthenticationServiceException("General Security SSL error!");
+            throw new RuntimeException("General Security SSL error!");
         }
     }
 

--
Gitblit v1.8.0