Errors lose the cause and don't name the field
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 68/100
Direzione di ricerca
Start with the named error paths in tt.go, converter.go, and mapper.go, then read tt_test.go:619 for the exact-message expectations. Use the reproduction snippets to check conversion failures, sequence errors, field context, and tuple-length errors. Done when the errors retain their causes and useful context, the relevant tests pass, and the user-visible message changes are documented in the CHANGELOG.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction snippets assume:
fac := tupleconv.MakeStringToTTConvFactory()
Where: MakeTypeToTTConverters (tt.go:295), MakeSequenceConverter (converter.go:77), Mapper.Map and validateTuple (mapper.go:27, mapper.go:50).
MakeTypeToTTConvertersreplaces the error withunexpected value %v for type %q: no%w, no field name or position, and%vmakes an empty value invisible.MakeSequenceConverterdrops the errors of all the converters it tried.Mapdoesn't say which field failed, and the length error has no lengths.
Reproduction:
convs, _ := tupleconv.MakeTypeToTTConverters[string](fac, []tupleconv.SpaceField{
{Name: "id", Type: "unsigned"}, {Name: "count", Type: "unsigned"}})
_, err := tupleconv.MakeMapper(convs).Map([]string{"1", ""})
fmt.Printf("%q\n", err)
_, err = tupleconv.MakeMapper(convs).Map([]string{"1", "2", "3"})
fmt.Printf("%q\n", err)
_, err = fac.GetIntegerConverter().Convert("1.5")
fmt.Printf("%q\n", err)
"unexpected value for type \"unsigned\""
"tuple length should be less or equal converters list length, when default converter is not used"
"unexpected value 1.5"
Suggested fix: wrap with %w and quote values with %q. Join the errors in MakeSequenceConverter with errors.Join. Name the field (SpaceField.Name and position) in MakeTypeToTTConverters. Wrap errors with the field index in Map, and put both lengths into the length error. A typed error (e.g. FieldError{Index, Name, Err}) would let callers handle it with errors.As. The messages are user-visible (tt_test.go:619 checks the exact text), so this needs a CHANGELOG entry.
- Lingua principale
- Go
- Stelle
- 1
- Fork
- 0
- Merge medio
- 1h 43m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 tarantool/go-tupleconv
-
build issue code health
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tarantool/go-tupleconv#27 ·
-
code health
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tarantool/go-tupleconv#26 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tarantool/go-tupleconv#25 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tarantool/go-tupleconv#23 ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
tarantool/go-tupleconv#22 ·
Tutte le issue di tarantool/go-tupleconv
Issue simili
-
☢️ Bug v3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
area/import-export area/projects concern/ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
go-vikunja/vikunja#4455 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Dependabot PRs no longer merge automaticallyForse già presa @dwisiswant0 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
projectdiscovery/urlfinder#160 ·
I maintainer di solito rispondono entro 1 giorno
-
database
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
chnm/legal-modernism#450 ·
I maintainer di solito rispondono entro 1 giorno
-
tech-debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno