message

package
v2.1.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendAlreadyExists

func SendAlreadyExists(w http.ResponseWriter, entityName string, err error)

func SendInvalidCredentials

func SendInvalidCredentials(w http.ResponseWriter, err error)

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

func New

func New(userMessage string, devMessage string, code sgerrors.ErrorCode, moreInfo string) Message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL