Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It seems to be lacking a mechanism for accumulating multiple errors, which can be done using a package like hashicorp/go-multierror.

The usage pattern is that you have a complex function that does something like parse a document and return the data from it. But the file format is so complex, that a lot of minor problems can occur, but they don't necessarily prevent you getting some data out. So the return value is the data and a set of errors (or warnings, if you like).



This might actually be addressed, albeit very quickly, in one of drafts: https://go.googlesource.com/proposal/+/master/design/go2draf....

>To implement formatting a tree of errors, an error list type could print itself as a new error chain, returning this single error with the entire chain as detail. Error list types occur fairly frequently, so it may be beneficial to standardize on an error list type to ensure consistency.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: