Take exception message from provider response in case of statusCode >= 400
まだ誰も着手していません。
評価
調査の方向性
src/Http/Provider/AbstractHttpProvider.php から始め、特に getParsedResponse と、68-87 行付近の InvalidServerResponse パスを確認します。provider ごとにレスポンス構造がどのように異なるかを検討し、そのうえで、ステータスコード >=400 の場合に汎用エラーではなく provider のメッセージを公開する戦略を定義します。この動作が選択した設計と一貫していれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hey guys.
So I as a developer would like to see message from provider response rather than generic The geocoder server returned an invalid response (%d) for query "%s". We could not parse it. message.
We faced with an issue which is pretty hard to debug on dockerized application. It would be much easier to understand what went wrong if we get message from particular provider response in case InvalidServerResponse is thrown on line: https://github.com/geocoder-php/Geocoder/blob/master/src/Http/Provider/AbstractHttpProvider.php#L78
The main issue that each provider has their own response structure in case of bad request occurs. I don't see a good solution here so far and I have only 2 thoughts so far:
getParsedResponsemethod need to be an abstract so each provider will implement their own mechanism of catching errors.
https://github.com/geocoder-php/Geocoder/blob/master/src/Http/Provider/AbstractHttpProvider.php#L68-L87- We could add another abstract method like
abstract protected function throwClientException(string $message)method inside of anAbstractHttpProviderclass. And each provider have to implement it.
I suppose it is kind of feature request.
- 主要言語
- PHP
- スター
- 4k
- フォーク
- 525
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
geocoder-php/Geocoder のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
geocoder-php/Geocoder#1272 ·
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
geocoder-php/Geocoder#1267 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
geocoder-php/Geocoder#1266 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 38/100
geocoder-php/Geocoder#1244 · コメント 2 件 · リアクション 2 件 ·
-
provider
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
geocoder-php/Geocoder#1243 ·
geocoder-php/Geocoder の issue をすべて見る
似ている issue
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
-
Перевод устарел
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
-
[6.x]: "Cannot use object of type stdClass as array" loading Users index (regression of #19182) オープン
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100