errmsg

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_INVALID_FILTER_VALUE         = "INVALID_FILTER_NAME"
	ERR_INVALID_FILTER_VALUE_MESSAGE = "The filter value you provided is not valid. Please check the format and try again."

	ERR_INVALID_URL_VALUE   = "INVALID_QUERY_PARAMETER"
	ERR_INVALID_URL_MESSAGE = "The URL parameter you provided is not valid. Please check the format and try again."

	ERR_INVALID_QUERY_VALUE   = "INVALID_QUERY_PARAMETER"
	ERR_INVALID_QUERY_MESSAGE = "The query parameter you provided is not valid. Please check the format and try again."

	ERR_INVALID_JSON_BODY    = "INVALID_JSON_BODY"
	ERR_INVALID_JSON_MESSAGE = "The JSON body you provided is not valid. Please check the format and try again."

	ERR_SERVER_ERROR   = "SERVER_ERROR"
	ERR_SERVER_MESSAGE = "A server error occurred. This is not your fault. Please try again later and contact the administrator."

	ERR_NOT_FOUND         = "NOT_FOUND"
	ERR_NOT_FOUND_MESSAGE = "The requested resource was not found."
)

Functions

func WriteErrorResponse

func WriteErrorResponse(w http.ResponseWriter, status int, code, message, details string)

func WriteInvalidFilterResponse

func WriteInvalidFilterResponse(w http.ResponseWriter, details string)

func WriteInvalidJsonResponse

func WriteInvalidJsonResponse(w http.ResponseWriter, details string)

func WriteInvalidQueryResponse

func WriteInvalidQueryResponse(w http.ResponseWriter, details string)

func WriteInvalidUrlResponse

func WriteInvalidUrlResponse(w http.ResponseWriter, details string)

func WriteNotFoundResponse

func WriteNotFoundResponse(w http.ResponseWriter, details string)

func WriteServerErrorResponse

func WriteServerErrorResponse(w http.ResponseWriter, details string)

Types

type ApiError

type ApiError struct {
	Status  int    `json:"status"`
	Error   string `json:"error"`
	Code    string `json:"code"`
	Message string `json:"message"`
	Details string `json:"details,omitempty"`
}

Jump to

Keyboard shortcuts

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