[Bug] Network errors are discarded.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với lib/graphql/client/http.rb, tại phần giá trị trả về theo kiểu Either, và lib/graphql/schema/loader.rb, nơi load_schema sử dụng dump_schema. Truy vết đường đi của lỗi qua load_schema và các bên gọi execute khác được đề cập, bao gồm query(), sau đó xác minh rằng các lỗi HTTP hoặc GraphQL vẫn còn khả dụng thay vì trở thành một KeyError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
If there's an HTTP error, calls to GraphQL::Client can return this:
KeyError: key not found: "data" (KeyError)
E.g., when I try the example in the readme to https://example.com/graphql, I expect some kind of network or HTTP error. Instead, I get the above KeyError.
I got this when making changes to my infrastructure. It made it very hard to debug problems.
I looked at load_schema, and found:
pry(main)> GraphQL::Client.load_schema(HTTP)
KeyError: key not found: "data" (KeyError)
from gems/3.4.0/gems/graphql-2.5.2/lib/graphql/schema/loader.rb:17:in 'Hash#fetch'
The load_schema call turns into load_schema(dump_schema(HTTP)). dump_schema seems to return full error info. So, between those two function calls, the information is lost:
[pry(main)> GraphQL::Client.dump_schema(HTTP)
=> {"errors" => [{"message" => "403 Forbidden"}]}
This happens other places that call execute, I believe, like .query().
In my opinion, the core problem is, the library uses fp-style Either error returns. However, Ruby doesn't have a way (like Rust or Haskell do) to enforce the handling of the error case. And so, it's possible to simply not handle them appropriately, like here.
Either-style API:
IMO, the fix is to use Ruby's Exception/Error facility so that library clients can meaningfully handle errors.
- Ngôn ngữ chính
- Ruby
- Star
- 78
- Fork
- 228
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
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.
Issue khác của github-community-projects/graphql-client
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
github-community-projects/graphql-client#78 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
github-community-projects/graphql-client#77 · 2 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
github-community-projects/graphql-client#76 · 4 bình luận · 1 reaction ·
-
Errors not populating correctlyĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
github-community-projects/graphql-client#75 · 1 bình luận · 1 reaction ·
-
InvalidNullError not showing up in GraphQL::Client::Response errors since Graphql-ruby 2.4.11Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
github-community-projects/graphql-client#65 · 1 bình luận ·
Tất cả issue của github-community-projects/graphql-client
Issue tương tự
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
OSCON 2016Đang mởcontent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
rubyevents/rubyevents#2148 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
we-promise/sure#3838 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ManageIQ/manageiq-ui-classic#10341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Obsolete link to RubyMine docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
rubocop/ruby-style-guide#984 ·