types

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Status  int
	Message string
}

AppError is a structured error that carries an HTTP status code. Handlers return *AppError instead of writing to the context directly, keeping business logic free of gin dependencies.

if user == nil {
    return response.NewError(http.StatusNotFound, "user not found")
}

func NewError

func NewError(status int, message string) *AppError

NewError constructs an *AppError.

func NewErrorf

func NewErrorf(status int, format string, args ...any) *AppError

NewErrorf constructs an *AppError with a formatted message.

func (*AppError) Error

func (e *AppError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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