29 lines
522 B
Go
29 lines
522 B
Go
package adverr
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestErr(t *testing.T) {
|
|
DisableTrace = false
|
|
err := doStuff()
|
|
Println(err)
|
|
}
|
|
|
|
func doStuff() error {
|
|
return Wrap("wrapped error", Wrap("test error", fmt.Errorf("asd: %w", errors.New("test"))))
|
|
}
|
|
|
|
func TestErrorChain(t *testing.T) {
|
|
|
|
errors := make([]error, 0)
|
|
|
|
errors = append(errors, doStuff())
|
|
errors = append(errors, doStuff())
|
|
errors = append(errors, doStuff())
|
|
|
|
Println(Chain("Neither of that stuff worked", errors))
|
|
}
|