Documentation
¶
Index ¶
- func SendInvalidJSON(w http.ResponseWriter, err error)
- func SendMessage(w http.ResponseWriter, msg Message, status int)
- func SendNotFound(w http.ResponseWriter, entityName string, err error)
- func SendUnknownError(w http.ResponseWriter, err error)
- func SendValidationFailed(w http.ResponseWriter, err error)
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendInvalidJSON ¶
func SendInvalidJSON(w http.ResponseWriter, err error)
func SendMessage ¶
func SendMessage(w http.ResponseWriter, msg Message, status int)
func SendNotFound ¶
func SendNotFound(w http.ResponseWriter, entityName string, err error)
func SendUnknownError ¶
func SendUnknownError(w http.ResponseWriter, err error)
func SendValidationFailed ¶
func SendValidationFailed(w http.ResponseWriter, err error)
SendValidationFailed - this is special case where frontend should parse dev message and present it on the UI
Types ¶
type Message ¶
type Message struct {
// UserMessage should be used to display message to user on UI/CLI
UserMessage string `json:"userMessage"`
// DevMessage should be used to display message to developer on API/console
DevMessage string `json:"devMessage"`
// ErrorCode is the unique identifier of an error
ErrorCode sgerrors.ErrorCode `json:"errorCode"`
// MoreInfo should be a link to supergiant documentation to display common problems
MoreInfo string `json:"moreInfo"`
}
Message is used in response body to display separate messages to user and developers
Click to show internal directories.
Click to hide internal directories.