summaryrefslogtreecommitdiff
path: root/proto/strfail.go
blob: 477df1a6f2ccca6d7d14bf4993969fd1aa59e938 (plain)
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
package proto

func Strfail(fail Object) string {
	switch fail.Kind {
	case "bad-target":
		return "unknown user or channel"
	case "unknown-name":
		return "unknown user or channel name"
	case "invalid":
		return "invalid action"
	case "forbidden":
		return "you don't have permission to do that"
	case "name-taken":
		return "name is in use: " + fail.Fields[""]
	case "invalid-name":
		return "name is too long or contains invalid characters: " + fail.Fields[""]
	case "too-long":
		return "message or status is too long"
	case "not-in-channel":
		return "you are not a member of this channel: " + fail.Fields[""]
	case "bad-reply":
		return "cannot reply to message (or message not found)"
	case "incorrect-password":
		return "incorrect username or password"
	case "password-required":
		return "you must log in with a password to do that"
	case "bad-auth-id":
		return "cannot login as this user (or user not found)"
	default:
		return "unknown error (" + fail.Kind + ")"
	}
}