update option

This commit is contained in:
2025-11-21 14:15:15 +03:00
parent 6300b35296
commit 516f22bd6c
25 changed files with 263 additions and 469 deletions

View File

@@ -0,0 +1,30 @@
package option
import (
"errors"
"fmt"
)
type Error struct {
Key []string
Err error
}
func (o Error) Error() string {
return fmt.Sprintf("%s: %s", o.Key, o.Err)
}
func (o Error) Is(err error) bool {
return errors.Is(err, o.Err)
}
func (o Error) Unwrap() error {
return o.Err
}
func Err(err error, key ...string) Error {
return Error{
Key: key,
Err: err,
}
}