aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/v2/errors.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2026-02-10 11:34:35 -0800
committerJoseph Tsai <joetsai@digital-static.net>2026-02-13 11:58:39 -0800
commit4dca8b3e619a321de36b99b6b514d9c01ef76e5e (patch)
treef15a3910c432793d34fe65f4ea7fbb1416239a53 /src/encoding/json/v2/errors.go
parent4f5d5ddf7c79305cc49c777efa3c365dd58f34df (diff)
downloadgo-4dca8b3e619a321de36b99b6b514d9c01ef76e5e.tar.xz
encoding/json/v2: dual support errors.ErrUnsupported and SkipFunc
This change supports both errors.ErrUnsupported and SkipFunc. In a future change, we will remove SkipFunc entirely in favor of using errors.ErrUnsupported, which exists for a similar pupose. Updates #74324 Change-Id: I5f1ada8e3914513d7d23c504f5965ca8dd95ad18 Reviewed-on: https://go-review.googlesource.com/c/go/+/745040 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Diffstat (limited to 'src/encoding/json/v2/errors.go')
-rw-r--r--src/encoding/json/v2/errors.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/encoding/json/v2/errors.go b/src/encoding/json/v2/errors.go
index 4895386fe2..da50bc30fc 100644
--- a/src/encoding/json/v2/errors.go
+++ b/src/encoding/json/v2/errors.go
@@ -299,6 +299,13 @@ func collapseSemanticErrors(err error) error {
return err
}
+func wrapErrUnsupported(err error, what string) error {
+ if errors.Is(err, errors.ErrUnsupported) {
+ return errors.New(what + " may not return errors.ErrUnsupported")
+ }
+ return err
+}
+
// errorModalVerb is a modal verb like "cannot" or "unable to".
//
// Once per process, Hyrum-proof the error message by deliberately