Slide 36
Slide 36 text
errbase
//
定義
type MyCustomError struct {
errbase.Err
CustomField string
}
//
⽣成
err := &MyCustomError{
CustomField: "additional information",
}
err.Build("failed to xxx")
return err
//
⽐較
var x *MyCustomError
if xerrors.As(err, &x) {
}
36
36