Go to file
2023-09-26 09:37:09 +02:00
go.mod Added README 2023-09-26 08:45:33 +02:00
pkg.go gofmt 2023-09-26 09:37:09 +02:00
README.md Update README.md 2023-09-26 08:46:03 +02:00

package main

import (
    // External
    werr "git.gibonuddevalla.se/go/wrappederror"

    // Standard
    "errors"
    "fmt"
)

func errorHandler(err werr.Error) {
    // For example print or log error to file
    fmt.Printf("ERROR - %s\n", err)
}

func foo() {
    werr.SetLogCallback(errorHandler)

    err := errors.New("foobar 1")
    err1 := werr.Wrap(err)

    err2 := werr.New("foobar 2")
}