fix: error formatting

This commit is contained in:
yusing
2025-05-04 07:12:28 +08:00
parent 7552a706a7
commit 5fce4b445b
3 changed files with 41 additions and 45 deletions

View File

@@ -91,6 +91,13 @@ func Collect[T any, Err error, Arg any, Func func(Arg) (T, Err)](eb *Builder, fn
return result
}
func Normal(err error) []byte {
if err == nil {
return nil
}
return []byte(err.Error())
}
func Plain(err error) []byte {
if err == nil {
return nil