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:
Sam Thanawalla 2025-08-06 13:02:10 -04:00 • committed by GitHub
commit 5bd02a3c04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
}
}