A powerful drop-in replacement for Go's standard error handling with rich features:
- 📍 Beautiful stacktraces with source locations
- 🎯 Error wrapping with context
- 🔄 Error catching and result handling
- ⚡ Panic recovery utilities
- 🛡️ Assert functions
- 🎨 Formatted error messages
- 🎁 Quality of life error handling helpers
Requires Go 1.21 or higher.
go get github.com/difof/errors
# Clone the repository
git clone https://github.com/difof/errors.git
cd errors
# Install task (if not already installed)
go install github.com/go-task/task/v3/cmd/task@latest
# Or go to https://taskfile.dev/installation
# Run tests
task test
# Run benchmarks
task bench
# Run demo
task demo
import "github.com/difof/errors"
func main() {
if err := riskyOperation(); err != nil {
fmt.Println(err.Error()) // Prints beautiful stacktrace
}
}
func riskyOperation() error {
return errors.New("something went wrong")
}
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.