]> Cypherpunks.ru repositories - gostls13.git/commitdiff
errors: add ErrUnsupported
authorAndy Pan <panjf2000@gmail.com>
Thu, 2 Mar 2023 03:57:24 +0000 (11:57 +0800)
committerGopher Robot <gobot@golang.org>
Sat, 11 Mar 2023 05:07:02 +0000 (05:07 +0000)
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>

api/next/41198.txt [new file with mode: 0644]
src/errors/errors.go

diff --git a/api/next/41198.txt b/api/next/41198.txt
new file mode 100644 (file)
index 0000000..6f83b18
--- /dev/null
@@ -0,0 +1 @@
+pkg errors, var ErrUnsupported error #41198
index 8436f812a6e5acc675b03cacae534d0a765cfb05..26db2d2bbfc937756c69f5257dbed1dd4b1f6ad2 100644 (file)
@@ -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")