bytecodealliance / bytecodealliance/go-modules
proposal: implement `Error` interface for error types
- Lingua principale
- Go
- Stelle
- 148
- Fork
- 20
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
building upon #127, can we add an `Error` method to error types so that in our sdk's we can directly return the error instead of having to map it to error msgs manually.
e.g. following method in the sdk could be just removed if we had that.
```
func errorVariantToError(err abc.Error) error {
switch {
case abc.ErrorInputNotSupported() == err:
return fmt.Errorf("input not supported")
case abc.RuntimeError() == err:
return fmt.Errorf("runtime error")
case abc.InvalidInput() == err:
return fmt.Errorf("invalid input")
default:
return fmt.Errorf("no error provided by host implementation")
}
}
```
Another thing we could possibly do is to replace "-" with " " automatically (to make it more readable), but its just a nice to have item.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia leggendo l’issue #127 e individuando i tipi di errore e l’helper SDK mostrati in questa issue. Determina quali valori di errore necessitano di metodi Error e verifica che i chiamanti dell’SDK possano restituirli direttamente; sostituire i trattini con spazi è facoltativo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- go
- Ambito
- api
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100