cockroachdb / cockroachdb/errors

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

Aberta
#87 1 comentário 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
2.5k
Forks
74
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.