geocoder-php / geocoder-php/Geocoder

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

Open
#1,204 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
PHP
Stars
4k
Forks
525
Avg merge
8m
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Http/Provider/AbstractHttpProvider.php, especially getParsedResponse and the InvalidServerResponse path around lines 68-87. Review how provider-specific response structures differ, then define a strategy that exposes the provider's message for status codes >=400 instead of the generic error; done when that behavior is consistent with the selected design.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.