add rest package

This commit is contained in:
Aneurin Barker Snook
2023-10-09 07:18:30 +01:00
commit 1fbda13eda
4 changed files with 150 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package rest
import "net/http"
// Err is an empty error, representing any REST API Error.
var Err = Error{}
// ErrBadRequest represents HTTP 400 Bad Request.
var ErrBadRequest = Error{
StatusCode: http.StatusBadRequest,
Message: "Bad request",
}
// ErrInternalServerError represents HTTP 500 Internal Server Error.
var ErrInternalServerError = Error{
StatusCode: http.StatusInternalServerError,
Message: "Internal server error",
}
// ErrNotFound represents HTTP 404 Not Found.
var ErrNotFound = Error{
StatusCode: http.StatusNotFound,
Message: "Not found",
}
// ErrUnavailable represents HTTP 503 Service Unavailable.
var ErrUnavailable = Error{
StatusCode: http.StatusServiceUnavailable,
Message: "Service unavailable",
}