-
Notifications
You must be signed in to change notification settings - Fork 3
/
errors.go
35 lines (28 loc) · 997 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package gokaf
import (
"fmt"
)
// TopicClosedError is a custom error type for indicating that a topic is already closed.
type TopicClosedError struct {
topicName string
}
// Error returns a string representation of the TopicClosedError.
func (e TopicClosedError) Error() string {
return fmt.Sprintf("Topic %s is already closed", e.topicName)
}
// newTopicClosedError creates a new instance of TopicClosedError.
func newTopicClosedError(topicName string) error {
return TopicClosedError{topicName: topicName}
}
// TopicExistsError is a custom error type for indicating that a topic already exists.
type TopicExistsError struct {
topicName string
}
// Error returns a string representation of the TopicExistsError.
func (e TopicExistsError) Error() string {
return fmt.Sprintf("Topic %s already exists", e.topicName)
}
// newTopicExistsError creates a new instance of TopicExistsError.
func newTopicExistsError(topicName string) error {
return TopicExistsError{topicName: topicName}
}