From 9022db972fec31cc01e986281fd9f5f8c2377a1d Mon Sep 17 00:00:00 2001 From: WillBooster-bot Date: Fri, 16 Jul 2021 08:44:55 +0900 Subject: [PATCH] fix: throw bad request if data-server returns error --- Utility/NetCommonsDataServer.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Utility/NetCommonsDataServer.php b/Utility/NetCommonsDataServer.php index bcccd89a..53a6ba13 100644 --- a/Utility/NetCommonsDataServer.php +++ b/Utility/NetCommonsDataServer.php @@ -92,11 +92,8 @@ static private function __request($curl) { $error = curl_error($curl); $code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE); curl_close($curl); - if ($errno !== CURLE_OK) { - throw new RuntimeException($error, $errno); - } - if ($code !== 200 && $code !== 202) { - throw new RuntimeException($code . ': ' . $result); + if ($errno !== CURLE_OK || ($code !== 200 && $code !== 202)) { + throw new BadRequestException(__d('net_commons', 'Bad Request')); } return $result; }