Skip to content

snicol/yael

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yael

Go

Yet Another Error Library

Yael (Hebrew: יעל‎, pronounced [jaˈʔel]; also spelled Jael) is a female given name, from the Hebrew meaning "Nubian Ibex".

Similar code is used across a lot of my side projects so I decided to standardise it.

Usage

// Errors with metadata
err := yael.New("permission_denied").WithMeta("user", 123)

// Wrapping errors
notAdminErr := yael.New("not_admin")
err = err.WithReason(notAdminErr)

// Satisfies Go's error interface
fmt.Println(err) // permission_denied

// Also Go 1.13+ error wrapping
errors.Is(err, notAdminErr) // true

// JSON representable:
{
    "code": "permission_denied",
    "meta": {
        "user": 123
    },
    "reason": {
        "code": "not_admin"
    }
}

About

Yet Another Error Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages