geocoder-php / geocoder-php/Geocoder

Take exception message from provider response in case of statusCode >= 400

未关闭
#1,204 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature request
主要语言
PHP
星标
4k
派生
525
平均合并
8 分钟
30 天内合并 PR
1

描述

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:

I suppose it is kind of feature request.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 src/Http/Provider/AbstractHttpProvider.php 开始,重点查看 getParsedResponse 以及 68-87 行附近的 InvalidServerResponse 路径。检查各 provider 特有的响应结构有何不同,然后定义一种策略,使状态码 >=400 时显示 provider 的消息,而不是通用错误;当该行为与所选设计保持一致时即完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
backend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。