cockroachdb / cockroachdb/errors

Decode context.Canceled, context.DeadlineExceeded etc as a reference to the stdlib instance

Aperta
#87 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
2.5k
Fork
74
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently, instances of the stdlib errors trasnferred over the network are decoded into an object of the same type/value, but not the same instance. So reference comparisons with `==` with the stdlib instance fail.

This matters for e.g. `context.Context.Err()` which describes in its API doc that it returns the standrd errors _unwrapped_ so it's legitimate for a caller to use `==`.

We could address that by adding a special case in the leaf decoder, so that if a leaf is one of the known stdlib errors, we return the stdlib instance instead.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.