(no title)
dematz | 1 month ago
here's an example that uses a field from your blog example error type: https://go.dev/play/p/SoVrnfXfzZy
Also "In Go, errors are values. They just aren’t particularly useful values"
...sometimes user mistakes are due to the language being too complicated, maybe for no benefit, but I don't think that's the case here. It's a very good thing that you can just slap .Error() on any error to print it quickly, and not too crazy complex to say an error can be any normal type that you can use, as long as it also can print Error()
MobiusHorizons|1 month ago
benrazdev|1 month ago
If I have
but I return it as an error: Then all the caller gets is an error interface. Without downcasting (`.(T)`/`errors.As`), you can only compare it to other instances (if the library author provided them) or see the string representation.