Skip to content

Commit

Permalink
Merge pull request #18 from TTATPuOT/master
Browse files Browse the repository at this point in the history
Нет выброса исключений при ошибке API
  • Loading branch information
Dmitry Kuznetsov authored Jul 16, 2019
2 parents 8c8a24c + 7c3774c commit 0660fba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/Yandex/Geo/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public function load(array $options = [])
$msg = sprintf('Can\'t load data by url: %s', $apiUrl);
throw new \Yandex\Geo\Exception($msg);
}
if (!empty($data['error'])) {
throw new \Yandex\Geo\Exception\MapsError($data['error']['message'], $data['error']['code']);
}

$this->_response = new \Yandex\Geo\Response($data);

Expand Down
12 changes: 12 additions & 0 deletions source/Yandex/Geo/Exception/MapsError.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
namespace Yandex\Geo\Exception;

/**
* Class ServerError
* @package Yandex\Geo\Exception
* @license The MIT License (MIT)
*/
class MapsError extends \Yandex\Geo\Exception
{

}

0 comments on commit 0660fba

Please # to comment.