Showing
3 changed files
with
23 additions
and
0 deletions
... | @@ -119,6 +119,10 @@ const getCharacterInfo = async function(nickname, characterCode) { | ... | @@ -119,6 +119,10 @@ const getCharacterInfo = async function(nickname, characterCode) { |
119 | } | 119 | } |
120 | }); | 120 | }); |
121 | 121 | ||
122 | + if (stats.major == 0) { | ||
123 | + throw new Error("no_major_stats") | ||
124 | + } | ||
125 | + | ||
122 | return { | 126 | return { |
123 | character: character, | 127 | character: character, |
124 | stats: stats | 128 | stats: stats |
... | @@ -129,6 +133,8 @@ const getCharacterInfo = async function(nickname, characterCode) { | ... | @@ -129,6 +133,8 @@ const getCharacterInfo = async function(nickname, characterCode) { |
129 | return -1; | 133 | return -1; |
130 | else if (error.message == "game_checking") | 134 | else if (error.message == "game_checking") |
131 | return -2; | 135 | return -2; |
136 | + else if (error.message == "no_major_stats") | ||
137 | + return -3; | ||
132 | else | 138 | else |
133 | return -999; | 139 | return -999; |
134 | } | 140 | } | ... | ... |
... | @@ -28,6 +28,10 @@ module.exports = { | ... | @@ -28,6 +28,10 @@ module.exports = { |
28 | // 점검중 | 28 | // 점검중 |
29 | res.status(503).send(); | 29 | res.status(503).send(); |
30 | return; | 30 | return; |
31 | + } else if (characterInfo == -3) { | ||
32 | + // 데이터를 받아오지 못함 | ||
33 | + res.status(502).send(); | ||
34 | + return; | ||
31 | } else if (characterInfo < 0) { | 35 | } else if (characterInfo < 0) { |
32 | res.status(400).send(); | 36 | res.status(400).send(); |
33 | return; | 37 | return; |
... | @@ -64,6 +68,12 @@ module.exports = { | ... | @@ -64,6 +68,12 @@ module.exports = { |
64 | } | 68 | } |
65 | }; | 69 | }; |
66 | 70 | ||
71 | + if (result.analysis.default.stats.major.pure == null) { | ||
72 | + // 데이터를 받아오지 못해 분석 실패 | ||
73 | + res.status(502).send(); | ||
74 | + return; | ||
75 | + } | ||
76 | + | ||
67 | console.log(JSON.stringify(result)); | 77 | console.log(JSON.stringify(result)); |
68 | res.send(result); | 78 | res.send(result); |
69 | } | 79 | } | ... | ... |
... | @@ -113,6 +113,10 @@ | ... | @@ -113,6 +113,10 @@ |
113 | } | 113 | } |
114 | }).then(function(response) { | 114 | }).then(function(response) { |
115 | character = response.data; | 115 | character = response.data; |
116 | + if(character.analysis.default.stats.major.pure == null) { | ||
117 | + M.toast({html:"메이플스토리로부터 데이터를 받아오지 못했습니다.<br><br>잠시 후에 시도해주세요."}); | ||
118 | + push('/'); | ||
119 | + } | ||
116 | isCharacterLoading = true; | 120 | isCharacterLoading = true; |
117 | }).catch(function(error) { | 121 | }).catch(function(error) { |
118 | switch(error.response.status) { | 122 | switch(error.response.status) { |
... | @@ -125,6 +129,9 @@ | ... | @@ -125,6 +129,9 @@ |
125 | window.open("https://maplestory.nexon.com/MyMaple/Account/Character/Visibility"); | 129 | window.open("https://maplestory.nexon.com/MyMaple/Account/Character/Visibility"); |
126 | }, 2000); | 130 | }, 2000); |
127 | break; | 131 | break; |
132 | + case 502: | ||
133 | + M.toast({html:"메이플스토리로부터 데이터를 받아오지 못했습니다.<br><br>잠시 후에 시도해주세요."}); | ||
134 | + break; | ||
128 | case 503: | 135 | case 503: |
129 | M.toast({html:"메이플스토리가 점검중입니다."}); | 136 | M.toast({html:"메이플스토리가 점검중입니다."}); |
130 | break; | 137 | break; | ... | ... |
-
Please register or login to post a comment