forked from realtime-framework/RealtimeMessaging-Go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.go
60 lines (46 loc) · 1.25 KB
/
exceptions.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package ortc
import "fmt"
type ortcServerErrorOperation int
const (
unexpected ortcServerErrorOperation = iota
validate
subscribe
subscribe_maxSize
unsubscribe_maxSize
send_maxSize
)
type ortcServerErrorException struct {
operation ortcServerErrorOperation
channel string
message string
}
func ortcAlreadyConnectedException() string {
return "Already Connected"
}
func ortcAuthenticationNotAuthorizedException(message string) string {
return message
}
func ortcDoesNotHavePermissionException(message string) string {
return message
}
func ortcEmptyFieldException(field string) string {
return fmt.Sprintf("%s is null or empty", field)
}
func ortcInvalidCharactersException(field string) string {
return fmt.Sprintf("%s has invalid characters", field)
}
func ortcInvalidMessageException(message string) string {
return message
}
func ortcMaxLengthException(field string, maxValue int) string {
return fmt.Sprintf("%s size exceed the limit of %d characters", field, maxValue)
}
func ortcNotConnectedException(message string) string {
return message
}
func ortcNotSubscribedException(channel string) string {
return fmt.Sprintf("Not subscribed to channel %s", channel)
}
func ortcSubscribedException(message string) string {
return message
}