For converting my internal errors to something for the API, which of those options is what I should be using in Go? (Or am I doing this completely incorrectly and there is a better option)
@mitsuhiko Option 2 (idiomatic error check); the std/low-level way is to use https://pkg.go.dev/net/http#Error, don’t know about the router/framework used where web.ExposeError is available.
http package - net/http - Go Packages

@henrikb web.ExposeError is just my function that converts my internal errors on the db layer to http.Error
@mitsuhiko the idiomatic error check is awkward first and so verbose, but I prefer it now over exceptions in other languages.
@henrikb @mitsuhiko Ever tried discriminated unions, like in Rust?