aboutsummaryrefslogtreecommitdiff
path: root/src/errors
diff options
context:
space:
mode:
authorAndy Pan <panjf2000@gmail.com>2023-03-02 11:57:24 +0800
committerGopher Robot <gobot@golang.org>2023-03-11 05:07:02 +0000
commit70f98a251efdbfd619c4ff466a43da299ad04752 (patch)
tree94b7b9c98cff303c052fb5f3685111f43735b909 /src/errors
parentd9c29ec6a54f929f4b0736db6b7598a4c2305e5e (diff)
downloadgo-70f98a251efdbfd619c4ff466a43da299ad04752.tar.xz
errors: add ErrUnsupported
Fixes #41198 Change-Id: Ib33a11d0eb311f8e2b81de24d11df49e00b2fc81 Reviewed-on: https://go-review.googlesource.com/c/go/+/473935 Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/errors')
-rw-r--r--src/errors/errors.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/errors/errors.go b/src/errors/errors.go
index 8436f812a6..26db2d2bbf 100644
--- a/src/errors/errors.go
+++ b/src/errors/errors.go
@@ -70,3 +70,18 @@ type errorString struct {
func (e *errorString) Error() string {
return e.s
}
+
+// ErrUnsupported indicates that a requested operation cannot be performed,
+// because it is unsupported. For example, a call to os.Link when using a
+// file system that does not support hard links.
+//
+// Functions and methods should not return this error but should instead
+// return an error including appropriate context that satisfies
+//
+// errors.Is(err, errors.ErrUnsupported)
+//
+// either by directly wrapping ErrUnsupported or by implementing an Is method.
+//
+// Functions and methods should document the cases in which an error
+// wrapping this will be returned.
+var ErrUnsupported = New("unsupported operation")