simplerr
Advanced Go error handling, made simple (by lobocv)
problem
Library to assist with RFC 7807 implementation for Go web services (by lpar)
simplerr | problem | |
---|---|---|
4 | 7 | |
20 | 6 | |
- | - | |
5.3 | 0.0 | |
5 months ago | almost 4 years ago | |
Go | Go | |
MIT License | BSD 3-clause "New" or "Revised" License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
simplerr
Posts with mentions or reviews of simplerr.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-04-28.
- A Simplerr way to use errors in Go!
- Error handling exhausted
- Proposal: errors.With(err, other error) error
-
How to reduce library dependency brought in from optional subpackages?
The project builds when i only imported "github.com/lobocv/simplerr". When I imported "github.com/lobocv/simplerr/ecosystem/grpc" the project to failed to build with this error:
problem
Posts with mentions or reviews of problem.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-04-28.
-
Proposal: errors.With(err, other error) error
The approach I tried for APIs was to do the opposite, and have the DB layer use an error type which includes an appropriate HTTP status code and details of exactly what's wrong as well as the regular error value.
-
Looking for code design opinions on checking errors for behaviour
If your goal is to report more meaningful structured errors to a REST API caller, you might find this helpful.
-
Exploring error for HTTP response
Check out https://github.com/lpar/problem
-
Logging error in go
You might find this helpful.
-
resperr: associate status codes and messages with your errors
Alternative which implements RFC 7807
-
Defining HTTP Status code from error types
For a web service, try RFC 7807. I've got a library to help implement it. A similar approach could help with regular application errors too.
-
Validation in Go. How do I answer on a invalid request via Rest API with html error template?
The best thing is to make your REST API respond as per RFC 7807 (helper Go library here), which gives you a standard way to add human-readable error messages. If the error should be displayed on a web page, handle that client-side using JavaScript DOM manipulation.
What are some alternatives?
When comparing simplerr and problem you can also consider the following projects:
errors - Go stdlib errors package extension.
errors - A drop-in replacement for Go errors, with some added sugar! Unwrap user-friendly messages, HTTP status code, easy wrapping with multiple error types.
error-pages - 🚧 Pretty server's error pages in the docker image & git repository (for traefik, k8s, nginx and so on)
optic - A simplified, generic, entity based web library for golang that's drop in compatible with net/http
grpcerr - A library which makes working with gRPC errors easy, both for gRPC and HTTP APIs.
problem - A Java library that implements application/problem+json
go - The Go programming language