Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vtadmin-api] Replace magic numbers with net/http constants #8127

Merged
merged 1 commit into from
May 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go/vt/vtadmin/errors/typed_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type BadRequest struct {
func (e *BadRequest) Error() string { return e.Err.Error() }
func (e *BadRequest) Code() string { return "bad request" }
func (e *BadRequest) Details() interface{} { return e.ErrDetails }
func (e *BadRequest) HTTPStatus() int { return 400 }
func (e *BadRequest) HTTPStatus() int { return http.StatusBadRequest }

// Unknown is the generic error, used when a more specific error is either
// unspecified or inappropriate.
Expand All @@ -52,7 +52,7 @@ type Unknown struct {
func (e *Unknown) Error() string { return e.Err.Error() }
func (e *Unknown) Code() string { return "unknown" }
func (e *Unknown) Details() interface{} { return e.ErrDetails }
func (e *Unknown) HTTPStatus() int { return 500 }
func (e *Unknown) HTTPStatus() int { return http.StatusInternalServerError }

// ErrInvalidCluster is returned when a cluster parameter, either in a route or
// as a query param, is invalid.
Expand All @@ -63,7 +63,7 @@ type ErrInvalidCluster struct {
func (e *ErrInvalidCluster) Error() string { return e.Err.Error() }
func (e *ErrInvalidCluster) Code() string { return "invalid cluster" }
func (e *ErrInvalidCluster) Details() interface{} { return nil }
func (e *ErrInvalidCluster) HTTPStatus() int { return 400 }
func (e *ErrInvalidCluster) HTTPStatus() int { return http.StatusBadRequest }

// MissingParams is returned when an HTTP handler requires parameters that were
// not provided.
Expand All @@ -77,7 +77,7 @@ func (e *MissingParams) Error() string {

func (e *MissingParams) Code() string { return "missing params" }
func (e *MissingParams) Details() interface{} { return nil }
func (e *MissingParams) HTTPStatus() int { return 400 }
func (e *MissingParams) HTTPStatus() int { return http.StatusBadRequest }

// NoSuchSchema is returned when a schema definition cannot be found for a given
// set of filter criteria. Both GetSchema and FindSchema can return this error.
Expand Down