errors

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package errors provides error classes for HTTP status codes.

Package errors provides error classes and response structures for HTTP status codes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequestHttpError

type BadRequestHttpError struct {
	Message string
}

func NewBadRequestHttpError

func NewBadRequestHttpError(err error) *BadRequestHttpError

func (*BadRequestHttpError) Error

func (e *BadRequestHttpError) Error() string

func (*BadRequestHttpError) StatusCode

func (e *BadRequestHttpError) StatusCode() int

type ErrorDetail

type ErrorDetail struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorDetail represents the structure of an error detail in the response.

type ErrorResponse

type ErrorResponse struct {
	Error ErrorDetail `json:"error"`
}

ErrorResponse represents the structure of an error response.

func NewBadRequestResponse

func NewBadRequestResponse(message string) *ErrorResponse

NewBadRequestResponse creates a new ErrorResponse for a 400 Bad Request error.

func NewConflictResponse

func NewConflictResponse(message string) *ErrorResponse

NewConflictResponse creates a new ErrorResponse for a 409 Conflict error.

func NewErrorResponse

func NewErrorResponse(statusCode int, message string) *ErrorResponse

NewErrorResponse creates a new ErrorResponse with the given status code and message.

func NewForbiddenResponse

func NewForbiddenResponse(message string) *ErrorResponse

NewForbiddenResponse creates a new ErrorResponse for a 403 Forbidden error.

func NewInternalServerErrorResponse

func NewInternalServerErrorResponse(message string) *ErrorResponse

NewInternalServerErrorResponse creates a new ErrorResponse for a 500 Internal Server Error.

func NewNotFoundResponse

func NewNotFoundResponse(message string) *ErrorResponse

NewNotFoundResponse creates a new ErrorResponse for a 404 Not Found error.

func NewServiceUnavailableResponse

func NewServiceUnavailableResponse(message string) *ErrorResponse

NewServiceUnavailableResponse creates a new ErrorResponse for a 503 Service Unavailable error.

func NewUnauthorizedResponse

func NewUnauthorizedResponse(message string) *ErrorResponse

NewUnauthorizedResponse creates a new ErrorResponse for a 401 Unauthorized error.

type ForbiddenHttpError

type ForbiddenHttpError struct {
	Message string
}

func NewForbiddenHttpError

func NewForbiddenHttpError(err error) *ForbiddenHttpError

func (*ForbiddenHttpError) Error

func (e *ForbiddenHttpError) Error() string

func (*ForbiddenHttpError) StatusCode

func (e *ForbiddenHttpError) StatusCode() int

type HTTPError

type HTTPError interface {
	error
	StatusCode() int // 상태 코드를 반환
}

type InternalServerHttpError

type InternalServerHttpError struct {
	Message string
}

func NewInternalServerHttpError

func NewInternalServerHttpError(err error) *InternalServerHttpError

func (*InternalServerHttpError) Error

func (e *InternalServerHttpError) Error() string

func (*InternalServerHttpError) StatusCode

func (e *InternalServerHttpError) StatusCode() int

type MethodNotAllowedHttpError

type MethodNotAllowedHttpError struct {
	Message string
}

func NewMethodNotAllowedHttpError

func NewMethodNotAllowedHttpError(err error) *MethodNotAllowedHttpError

func (*MethodNotAllowedHttpError) Error

func (e *MethodNotAllowedHttpError) Error() string

func (*MethodNotAllowedHttpError) StatusCode

func (e *MethodNotAllowedHttpError) StatusCode() int

type NotFoundHttpError

type NotFoundHttpError struct {
	Message string
}

func NewNotFoundHttpError

func NewNotFoundHttpError(err error) *NotFoundHttpError

func (*NotFoundHttpError) Error

func (e *NotFoundHttpError) Error() string

func (*NotFoundHttpError) StatusCode

func (e *NotFoundHttpError) StatusCode() int

type ServiceUnavailableHttpError

type ServiceUnavailableHttpError struct {
	Message string
}

func NewServiceUnavailableHttpError

func NewServiceUnavailableHttpError(err error) *ServiceUnavailableHttpError

func (*ServiceUnavailableHttpError) Error

func (*ServiceUnavailableHttpError) StatusCode

func (e *ServiceUnavailableHttpError) StatusCode() int

type UnauthorizedHttpError

type UnauthorizedHttpError struct {
	Message string
}

func NewUnauthorizedHttpError

func NewUnauthorizedHttpError(err error) *UnauthorizedHttpError

func (*UnauthorizedHttpError) Error

func (e *UnauthorizedHttpError) Error() string

func (*UnauthorizedHttpError) StatusCode

func (e *UnauthorizedHttpError) StatusCode() int

Jump to

Keyboard shortcuts

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