Remove ‘Signal’ from structure names
[go-signalcontext.git] / error.go
diff --git a/error.go b/error.go
new file mode 100644 (file)
index 0000000..c0a4f97
--- /dev/null
+++ b/error.go
@@ -0,0 +1,20 @@
+package signalcontext
+
+import (
+       "fmt"
+       "os"
+)
+
+// A Error will be returned by a SignalContext’s Err() method when it
+// was finished due to a signal (rather than e.g. parent cancellation).
+type Error struct {
+       os.Signal
+}
+
+func (e Error) Error() string {
+       return e.String()
+}
+
+func (e Error) String() string {
+       return fmt.Sprintf("received signal: %s", e.Signal)
+}