From fae525fdf1dfe011a62aa9f5f1f9b9dfc409e5f9 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 10 May 2023 12:02:11 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=83,=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B3=D0=B4=D0=B0=20error=20=D0=B1=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D0=B5=D1=82=20=D0=BD=D0=B5=20=D0=BC=D0=B0=D1=81=D1=81?= =?UTF-8?q?=D0=B8=D0=B2=D0=BE=D0=BC,=20=D0=B0=20=D0=BF=D1=80=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=BE=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Yandex/Geo/Api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Yandex/Geo/Api.php b/source/Yandex/Geo/Api.php index 84248ea..298fbc6 100644 --- a/source/Yandex/Geo/Api.php +++ b/source/Yandex/Geo/Api.php @@ -90,7 +90,11 @@ public function load(array $options = []) throw new \Yandex\Geo\Exception($msg); } if (!empty($data['error'])) { - throw new \Yandex\Geo\Exception\MapsError($data['error']['message'], $data['error']['code']); + if (is_array($data['error'])) { + throw new \Yandex\Geo\Exception\MapsError($data['error']['message'], $data['error']['code']); + } else { + throw new \Yandex\Geo\Exception\MapsError($data['error']); + } } $this->_response = new \Yandex\Geo\Response($data); From 77dded5653c373d1067706a093a340520c397611 Mon Sep 17 00:00:00 2001 From: Anton Date: Wed, 10 May 2023 12:07:10 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9D=D0=B0=20=D0=B2=D1=81=D1=8F=D0=BA?= =?UTF-8?q?=D0=B8=D0=B9=20=D1=81=D0=BB=D1=83=D1=87=D0=B0=D0=B9=20=D1=81?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D1=83=20=D0=B2=D1=81=D0=B5=20=D0=B2=D0=BE?= =?UTF-8?q?=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D1=8B=D1=85=20=D0=BC=D0=B0=D1=81?= =?UTF-8?q?=D1=81=D0=B8=D0=B2=D0=BE=D0=B2=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Yandex/Geo/Api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/Yandex/Geo/Api.php b/source/Yandex/Geo/Api.php index 298fbc6..80a2e48 100644 --- a/source/Yandex/Geo/Api.php +++ b/source/Yandex/Geo/Api.php @@ -92,6 +92,9 @@ public function load(array $options = []) if (!empty($data['error'])) { if (is_array($data['error'])) { throw new \Yandex\Geo\Exception\MapsError($data['error']['message'], $data['error']['code']); + } else if (!empty($data['message'])) { + $code = !empty($data['statusCode']) ? $data['statusCode'] : 0; + throw new \Yandex\Geo\Exception\MapsError($data['message'], $code); } else { throw new \Yandex\Geo\Exception\MapsError($data['error']); }