From f22f12b4fc1c9aa733cf68000afb425a87dcc222 Mon Sep 17 00:00:00 2001 From: citrons Date: Sun, 1 Jun 2025 15:26:52 -0500 Subject: error message strings --- proto/strfail.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 proto/strfail.go (limited to 'proto/strfail.go') 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" + } +} -- cgit v1.2.3