summaryrefslogtreecommitdiff
path: root/proto/strfail.go
diff options
context:
space:
mode:
Diffstat (limited to 'proto/strfail.go')
-rw-r--r--proto/strfail.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/proto/strfail.go b/proto/strfail.go
new file mode 100644
index 0000000..83f314b
--- /dev/null
+++ b/proto/strfail.go
@@ -0,0 +1,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"
+ }
+}