[Bug] Network errors are discarded.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con lib/graphql/client/http.rb intorno al valore restituito in stile Either e con lib/graphql/schema/loader.rb, dove load_schema consuma dump_schema. Segui il percorso dell’errore attraverso load_schema e gli altri chiamanti di execute menzionati, incluso query(), quindi verifica che gli errori HTTP o GraphQL rimangano disponibili invece di diventare un KeyError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Ruby
- Stelle
- 78
- Fork
- 228
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
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.
Altre issue di github-community-projects/graphql-client
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
github-community-projects/graphql-client#78 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
github-community-projects/graphql-client#77 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
github-community-projects/graphql-client#76 · 4 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
github-community-projects/graphql-client#75 · 1 commento · 1 reazione ·
-
InvalidNullError not showing up in GraphQL::Client::Response errors since Graphql-ruby 2.4.11Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
github-community-projects/graphql-client#65 · 1 commento ·
Tutte le issue di github-community-projects/graphql-client
Issue simili
-
security
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
OSCON 2016Apertacontent
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
rubyevents/rubyevents#2148 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
we-promise/sure#3838 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Allow simp/useradd 4.xAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
simp/pupmod-simp-pam#244 ·
I maintainer di solito rispondono entro 7 giorni
-
Mend: dependency security vulnerability
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ManageIQ/manageiq-ui-classic#10341 ·
I maintainer di solito rispondono entro 1 giorno