Documentation
¶
Overview ¶
Package errors provides error classes for HTTP status codes.
Package errors provides error classes and response structures for HTTP status codes.
Index ¶
- type BadRequestHttpError
- type ErrorDetail
- type ErrorResponse
- func NewBadRequestResponse(message string) *ErrorResponse
- func NewConflictResponse(message string) *ErrorResponse
- func NewErrorResponse(statusCode int, message string) *ErrorResponse
- func NewForbiddenResponse(message string) *ErrorResponse
- func NewInternalServerErrorResponse(message string) *ErrorResponse
- func NewNotFoundResponse(message string) *ErrorResponse
- func NewServiceUnavailableResponse(message string) *ErrorResponse
- func NewUnauthorizedResponse(message string) *ErrorResponse
- type ForbiddenHttpError
- type HTTPError
- type InternalServerHttpError
- type MethodNotAllowedHttpError
- type NotFoundHttpError
- type ServiceUnavailableHttpError
- type UnauthorizedHttpError
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 ¶
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 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 {
}func NewServiceUnavailableHttpError ¶
func NewServiceUnavailableHttpError(err error) *ServiceUnavailableHttpError
func (*ServiceUnavailableHttpError) Error ¶
func (e *ServiceUnavailableHttpError) Error() string
func (*ServiceUnavailableHttpError) StatusCode ¶
func (e *ServiceUnavailableHttpError) StatusCode() int
type UnauthorizedHttpError ¶
type UnauthorizedHttpError struct {
}func NewUnauthorizedHttpError ¶
func NewUnauthorizedHttpError(err error) *UnauthorizedHttpError
func (*UnauthorizedHttpError) Error ¶
func (e *UnauthorizedHttpError) Error() string
func (*UnauthorizedHttpError) StatusCode ¶
func (e *UnauthorizedHttpError) StatusCode() int