errors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessProviderCallFailed

func AccessProviderCallFailed(err error) (code int, body gin.H)
{
	"type":   "/errors/providers",
	"title":  "Failure calling access provider",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func AccessProviderCallPartiallyFailed

func AccessProviderCallPartiallyFailed(err error) (code int, body gin.H)
{
	"type":   "/errors/providers",
	"title":  "Partial failure calling access provider",
	"status": http.StatusMultiStatus,
	"error":  err.Error(),
}

func ErrorAuthInvalidToken

func ErrorAuthInvalidToken(err error, scope string) (code int, body gin.H)
{
	"type":   "/errors/middleware-auth",
	"title":  "Invalid token",
	"scope": scope,
	"status": http.StatusUnauthorized,
	"error":  err.Error(),
}

func ErrorAuthMissingAuthHeader

func ErrorAuthMissingAuthHeader(err error) (code int, body gin.H)
{
	"type":   "/errors/middleware-auth",
	"title":  "Required headers are missing",
	"status": http.StatusUnauthorized,
	"error":  err.Error(),
}

func ErrorAuthOidcInit

func ErrorAuthOidcInit(err error) (code int, body gin.H)
{
	"type":   "/errors/middleware-auth",
	"title":  "Failed to init OIDC provider",
	"status": http.StatusUnauthorized,
	"error":  err.Error(),
}

func ErrorAuthTokenVerificationFailed

func ErrorAuthTokenVerificationFailed(err error, scope string) (code int, body gin.H)
{
	"type":   "/errors/middleware-auth",
	"title":  "Token verification failed",
	"scope":  scope,
	"status": http.StatusUnauthorized,
	"error":  err.Error(),
}

func ErrorBase64

func ErrorBase64(err error) (code int, body gin.H)
{
	"type":   "/errors/base64",
	"title":  "Failed to decode/encode base64",
	"status": http.StatusInternalServerError,
	"error":  err.Error(),
}

func ErrorDatabaseInsert

func ErrorDatabaseInsert(err error) (code int, body gin.H)
{
	"type":   "/errors/database",
	"title":  "Failed to insert into database",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorDatabaseRecordNotFound

func ErrorDatabaseRecordNotFound() (code int, body gin.H)
{
	"type":   "/errors/database",
	"title":  "Record not found",
	"status": http.StatusBadRequest,
}

func ErrorDatabaseSelect

func ErrorDatabaseSelect(err error) (code int, body gin.H)
{
	"type":   "/errors/database",
	"title":  "Failed to query the database",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorInvalidUserProfile

func ErrorInvalidUserProfile(err error) (code int, body gin.H)
{
	"type":   "/errors/user-profile",
	"title":  "Invalid user profile configuration",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorJsonUnmarshal

func ErrorJsonUnmarshal(err error) (code int, body gin.H)
{
	"type":   "/errors/json-decode",
	"title":  "Failed to decode JSON",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorSchemaValidation

func ErrorSchemaValidation(err error) (code int, body gin.H)
{
	"type":   "/errors/schema-validation",
	"title":  "Schema validation failed",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorTeleportApi

func ErrorTeleportApi(err error) (code int, body gin.H)
{
	"type":   "/errors/teleport-api",
	"title":  "Failure Teleport API",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func ErrorTracing

func ErrorTracing(err error) (code int, body gin.H)
{
	"type":   "/errors/tracing",
	"title":  "Failure creating trace",
	"status": http.StatusInternalServerError,
	"error":  err.Error(),
}

func ErrorYamlUnmarshal

func ErrorYamlUnmarshal(err error) (code int, body gin.H)
{
	"type":   "/errors/yaml-decode",
	"title":  "Failed to decode YAML",
	"status": http.StatusBadRequest,
	"error":  err.Error(),
}

func StatusCreated

func StatusCreated() (code int, body gin.H)
{
	"type":   "/status/success",
	"title":  "Record successfully created",
	"status": http.StatusCreated,
}

func StatusDeleted

func StatusDeleted() (code int, body gin.H)
{
	"type":   "/status/success",
	"title":  "Record successfully deleted",
	"status": http.StatusOK,
}

func StatusDenied

func StatusDenied() (code int, body gin.H)
{
	"type":   "/status/denied",
	"title":  "You are not authorised to perform this action",
	"status": http.StatusForbidden,
}

func StatusOk

func StatusOk() (code int, body gin.H)
{
	"type":   "/status/ok",
	"title":  "Operation was successful",
	"status": http.StatusOk,
}

func StatusUpdated

func StatusUpdated() (code int, body gin.H)
{
	"type":   "/status/success",
	"title":  "Record successfully updated",
	"status": http.StatusCreated,
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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