公開webページ管理
Revision | 2987edde366dd8eb149805803043f23646aa8ac3 (tree) |
---|---|
Time | 2021-02-02 22:02:34 |
Author | Habu <habu@user...> |
Commiter | Habu |
[add] スコア登録に失敗した時のエラーメッセージ
スコア登録に失敗した時、単にexitしているだけでだったので
失敗した処理とその原因が掴みづらかった。
エラーの箇所とその内容をerrors/register_score.logに
出力して、後で確認できるようにする。
@@ -194,11 +194,13 @@ function validate_screen_dump($screen_dump_lines) | ||
194 | 194 | |
195 | 195 | $recv_encoding = get_mb_encoding(); |
196 | 196 | if ($recv_encoding === false) { |
197 | + error_log("get_mb_encoding() FAILED"); | |
197 | 198 | exit; |
198 | 199 | } |
199 | 200 | |
200 | 201 | $recv_contents = file_get_contents('php://input'); |
201 | 202 | if (strlen($recv_contents) !== filter_input(INPUT_SERVER, 'CONTENT_LENGTH', FILTER_VALIDATE_INT)) { |
203 | + error_log("CONTENT_LENGTH does not match"); | |
202 | 204 | exit; |
203 | 205 | } |
204 | 206 |
@@ -206,6 +208,9 @@ $recv_contents = mb_convert_encoding($recv_contents, "UTF-8", $recv_encoding); | ||
206 | 208 | |
207 | 209 | $split_contents = split_recv_contents($recv_contents); |
208 | 210 | if ($split_contents === false) { |
211 | + error_log("split_recv_contents() FAILED"); | |
212 | + error_log("recv_contents:"); | |
213 | + error_log($recv_contents); | |
209 | 214 | exit; |
210 | 215 | } |
211 | 216 |
@@ -215,6 +220,8 @@ $db = new ScoreDB(); | ||
215 | 220 | $score_id = $db->register_new_score(create_db_insert_score_data($char_info)); |
216 | 221 | |
217 | 222 | if ($score_id === false) { |
223 | + error_log("register_new_score() FAILED!"); | |
224 | + error_log(print_r($char_info, true)); | |
218 | 225 | exit; |
219 | 226 | } |
220 | 227 |