X-Git-Url: https://git.korewanetadesu.com/?p=go-signalcontext.git;a=blobdiff_plain;f=error.go;fp=error.go;h=c0a4f9724a3f7eebc2996a3284733aef5236348f;hp=0000000000000000000000000000000000000000;hb=8cf685c73e37c718d1dcfe057caad080196f3e18;hpb=f6b6f942533c75bd0b6884816e652794def00e44 diff --git a/error.go b/error.go new file mode 100644 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) +}