Error handling in Go web apps shouldn't be so awkward

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • sandwich

    Sandwich is a delicious middleware framework for go that lets you write and test your handlers easily. (by augustoroman)

  • https://github.com/augustoroman/sandwich is another approach for achieving a similar result. One nice aspect of writing handlers that return errors is that they are easy to test and clean to write.

    Sandwich does very simple sequencing to achieve an understandable dependency injection mechanism that produces clear errors when something goes wrong, and it produces errors at setup time rather than run time.

  • public-error-go

    A tiny Go library for transparently adding public client messages to error stacks

  • In general, the way you output errors to the client and the errors you log are two totally different things. This is a slight tweak from the problem the author is attempting to solve by letting the client see the error.

    Like the author, I created a special error interface I can look for when returning client errors: https://github.com/Xeoncross/public-error-go

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Caddy

    Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

  • The article basically describes how Caddy does error handling in HTTP routes.

    https://github.com/caddyserver/caddy/blob/cb86319bd50322d4ac...

  • vscode-go

    Go extension for Visual Studio Code (by golang)

  • Goland collapses this to a single line, and vscode is looking into it too.

    https://github.com/golang/vscode-go/issues/2311

    It papers over the issue, but helps some.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts