2021-06-06 22:07:29 +00:00
|
|
|
// Package pubsub implements pub/sub interfaces defined in package fleet.
|
2016-10-31 22:51:19 +00:00
|
|
|
package pubsub
|
2016-12-27 15:35:19 +00:00
|
|
|
|
|
|
|
// Error defines the interface of errors specific to the pubsub package
|
|
|
|
type Error interface {
|
|
|
|
error
|
|
|
|
// NoSubscriber returns true if the error occurred because there are no
|
|
|
|
// subscribers on the channel
|
|
|
|
NoSubscriber() bool
|
|
|
|
}
|
|
|
|
|
|
|
|
// NoSubscriberError can be returned when channel operations fail because there
|
|
|
|
// are no subscribers. Its NoSubscriber() method always returns true.
|
|
|
|
type noSubscriberError struct {
|
|
|
|
Channel string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e noSubscriberError) Error() string {
|
|
|
|
return "no subscriber for channel " + e.Channel
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e noSubscriberError) NoSubscriber() bool {
|
|
|
|
return true
|
|
|
|
}
|