pocke.goevent/errors.go

26 lines
535 B
Go
Raw Normal View History

2015-01-12 13:51:59 +08:00
package goevent
import "fmt"
2015-01-17 16:44:47 +08:00
// EventNotDefined is an error indicationg that the event has not been defined.
2015-01-12 13:51:59 +08:00
type EventNotDefined struct {
eventName string
}
func newEventNotDefined(name string) *EventNotDefined {
return &EventNotDefined{
eventName: name,
}
}
func (e *EventNotDefined) Error() string {
return fmt.Sprintf("%s event has not been defined yet.", e.eventName)
}
2015-01-17 16:44:47 +08:00
// EventName return name of the event.
2015-01-12 13:51:59 +08:00
func (e *EventNotDefined) EventName() string {
return e.eventName
}
2015-01-12 14:13:13 +08:00
var _ error = newEventNotDefined("foo")