summaryrefslogtreecommitdiff
path: root/proto/strfail.go
blob: 83f314bd254a75af1b882b1feffd4dc35f791805 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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 "not-in-channel":
		return "you are not a member of this channel: " + fail.Fields[""]
	default:
		return "unknown error"
	}
}