Skip to content

Commit

Permalink
add 410, 425 error constructs
Browse files Browse the repository at this point in the history
  • Loading branch information
manigandand committed Oct 5, 2023
1 parent b3d4a12 commit 4c20f8d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions errors/error_constructors.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func Conflict(message string) *AppError { // 409
return NewAppError(http.StatusConflict, message)
}

// Gone will return `http.StatusGone` with custom message.
func Gone(message string) *AppError { // 410
return NewAppError(http.StatusGone, message)
}

// UnprocessableEntity will return `http.StatusUnprocessableEntity` with
// custom message.
func UnprocessableEntity(message string) *AppError { // 422
Expand All @@ -93,6 +98,12 @@ func TooManyRequests(message string) *AppError { // 422
return NewAppError(http.StatusTooManyRequests, message)
}

// TooEarly will return `http.StatusTooEarly` with
// custom message.
func TooEarly(message string) *AppError { // 425
return NewAppError(http.StatusTooEarly, message)
}

// 5xx -------------------------------------------------------------------------

// InternalServer will return `http.StatusInternalServerError` with custom message.
Expand Down

0 comments on commit 4c20f8d

Please sign in to comment.