package weberror import "github.com/pkg/errors" // shutdown is a type used to help with the graceful termination of the service. type shutdown struct { Message string } // Error is the implementation of the error interface. func (s *shutdown) Error() string { return s.Message } // NewShutdownError returns an error that causes the framework to signal // a graceful shutdown. func NewShutdownError(message string) error { return &shutdown{message} } // IsShutdown checks to see if the shutdown error is contained // in the specified error value. func IsShutdown(err error) bool { if _, ok := errors.Cause(err).(*shutdown); ok { return true } return false }