Change errors to use xerrors package.

This commit is contained in:
2025-05-12 20:37:58 +03:00
committed by antanst
parent 5fe1490f1e
commit b8ea6fab4a
7 changed files with 39 additions and 165 deletions

View File

@@ -0,0 +1,29 @@
package commonErrors
import (
"errors"
"git.antanst.com/antanst/xerrors"
)
type HostError struct {
xerrors.XError
}
func IsHostError(err error) bool {
var temp *HostError
return errors.As(err, &temp)
}
func NewHostError(err error) error {
xerr := xerrors.XError{
UserMsg: "",
Code: 0,
Err: err,
IsFatal: false,
}
return &HostError{
xerr,
}
}