Skip to content
/ errors Public

Drop-in errors replacement for go, supporting stacktraces and handling utilities

License

Notifications You must be signed in to change notification settings

difof/errors

Repository files navigation

errors

Go Reference Go Report Card License: MIT Go Version Build Status

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.

go get github.com/difof/errors

🏗️ Building from Source

# 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

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 file for details.

About

Drop-in errors replacement for go, supporting stacktraces and handling utilities

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages