jsonschema: copy wrapf into jsonschema/util.go (#254)
jsonschema depends on wrapf in mcp/util.go, copy this into jsonschema for the code move.
This commit is contained in:
parent
b392875dc5
commit
5bd02a3c04
1 changed files with 10 additions and 7 deletions
|
|
@ -454,3 +454,10 @@ func fieldJSONInfo(f reflect.StructField) jsonInfo {
|
|||
}
|
||||
return info
|
||||
}
|
||||
|
||||
// wrapf wraps *errp with the given formatted message if *errp is not nil.
|
||||
func wrapf(errp *error, format string, args ...any) {
|
||||
if *errp != nil {
|
||||
*errp = fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), *errp)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue