https://github.com/difof/errors
Drop-in errors replacement for go, supporting stacktraces and handling utilities
https://github.com/difof/errors
error-handling errors go golang stacktrace
Last synced: 5 months ago
JSON representation
Drop-in errors replacement for go, supporting stacktraces and handling utilities
- Host: GitHub
- URL: https://github.com/difof/errors
- Owner: difof
- License: mit
- Created: 2023-12-05T10:03:36.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T06:11:13.000Z (over 1 year ago)
- Last Synced: 2025-04-25T13:04:02.471Z (about 1 year ago)
- Topics: error-handling, errors, go, golang, stacktrace
- Language: Go
- Homepage:
- Size: 106 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# errors
[](https://pkg.go.dev/github.com/difof/errors)
[](https://goreportcard.com/report/github.com/difof/errors)
[](https://opensource.org/licenses/MIT)
[](https://golang.org/dl/)
[](https://github.com/difof/errors/actions)
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
## 📦 Installation
Requires Go 1.21 or higher.
```bash
go get github.com/difof/errors
```
## 🏗️ Building from Source
```bash
# 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
```
## 🚀 Quick Start
```go
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")
}
```
## 🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.