summaryrefslogtreecommitdiff
path: root/types/error
diff options
context:
space:
mode:
Diffstat (limited to 'types/error')
-rw-r--r--types/error/error.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/types/error/error.go b/types/error/error.go
new file mode 100644
index 0000000..9697e9d
--- /dev/null
+++ b/types/error/error.go
@@ -0,0 +1,24 @@
+package err
+
+// Translated defines the type for translated strings
+// It is a map from language tags to error messages
+type Translated map[string]string
+
+// Error is the struct that defines the public error types
+// This contains the error message with translations
+// And other info
+type Error struct {
+ // Message defines the error message
+ // It is a map from language tags to messages
+ // If a language is not translated, the whole language tag key is missing
+ // E.g. compare (english and french translations)
+ // {"en": "hello", "fr": "bonjour"}
+ // and
+ // {"en": "hello"}
+ // English is always present and should be used as a fallback
+ Message Translated `json:"message"`
+
+ // Misc indicates whether or not this error is only there for miscellaneous purposes
+ // If this is set to True, the client UI SHOULD NOT show this error
+ Misc bool `json:"misc"`
+}