this post was submitted on 03 Sep 2023
1 points (100.0% liked)

The Go Programming Language

1 readers
0 users here now

Ask questions and post articles about the Go programming language and related tools, events etc.

founded 1 year ago
MODERATORS
 
This is an automated archive.

The original was posted on /r/golang by /u/jhoepken on 2023-09-03 11:07:23+00:00.


I'm relatively new to Go, but a seasoned developer in other languages (Python and C++). At the moment I'm developing an API using Gin and have some trouble wrapping my head around how I should do my error handling in a "go way". On the code level, where I define my handlers, I can return HTTP status codes via Gin. Lower down into the business logic, should I pass errors up (e.g. via fmt.Errorf ?)

How do you do it? Are there are best practices, that I should know?

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here