geocoder-php / geocoder-php/Geocoder
Take exception message from provider response in case of statusCode >= 400
Nessuno ha ancora preso questa issue.
- Lingua principale
- PHP
- Stelle
- 4k
- Fork
- 525
- Merge medio
- 8m
- PR unite (30g)
- 1
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da src/Http/Provider/AbstractHttpProvider.php, in particolare da getParsedResponse e dal percorso InvalidServerResponse intorno alle righe 68-87. Esamina le differenze tra le strutture delle risposte specifiche dei provider, quindi definisci una strategia che esponga il messaggio del provider per i codici di stato >=400 invece dell’errore generico; il lavoro è completato quando questo comportamento è coerente con il design selezionato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100