summaryrefslogtreecommitdiff
path: root/types/error/error.go
blob: 7723c97627093677c999cc81d17ec191762ce1f5 (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
// Package err defines public error types that are returned to clients
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"`
}