Skip to content

SSSOCPaulCote/blunderguard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blunderguard

A sentinel error package in Go as described by Dave Cheney

Usage

Blunderguard is very simple

import (
    "fmt"

    bg "github.com/SSSOC-CAN/blunderguard"
)

const (
    ErrInvalidAction = bg.Error("invalid action")
)

func DoSomething() error {
    return ErrInvalidAction
}

func main() {
    err := DoSomething()
    if err == ErrInvalidAction {
        fmt.Println("There you go")
    }
}

Now your errors are immutable, fungible and constants. Enjoy!

About

A sentinel error package in Go as described by Dave Cheney

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages