Skip to content

Latest commit

 

History

History
38 lines (29 loc) · 501 Bytes

File metadata and controls

38 lines (29 loc) · 501 Bytes

terr

A traceable error library for golang.

Example

import (
    "net/http"

    "github.com/deadblue/terr"
)

func loadData() (err error) {
    resp, err := terr.Trace(http.Get("http://example.com/"))
    if err != nil {
        return
    }
    defer resp.Close()
    // TODO: Parse resp
}

func divide(m, n int) (err error) {
    if (n == 0) {
        err = terr.New("can not divide by zero")
    }
    return
}

func main() {
    loadData()
    divide(5, 0)
}

License

MIT