geocoder-php / geocoder-php/Geocoder
Take exception message from provider response in case of statusCode >= 400
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- PHP
- Star
- 4k
- Fork
- 525
- Merge trung bình
- 8 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với src/Http/Provider/AbstractHttpProvider.php, đặc biệt là getParsedResponse và nhánh InvalidServerResponse quanh các dòng 68-87. Xem xét các cấu trúc response riêng của từng provider khác nhau như thế nào, sau đó xác định một chiến lược để hiển thị message của provider đối với các status code >=400 thay vì lỗi chung; hoàn thành khi hành vi đó nhất quán với design đã chọn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- backend
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100