mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Enable errname linter and fix findings (#13341)
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func HandleError(w http.ResponseWriter, message string, code int) {
|
||||
errJson := &DefaultErrorJson{
|
||||
errJson := &DefaultJsonError{
|
||||
Message: message,
|
||||
Code: code,
|
||||
}
|
||||
|
||||
@@ -16,17 +16,17 @@ type HasStatusCode interface {
|
||||
StatusCode() int
|
||||
}
|
||||
|
||||
// DefaultErrorJson is a JSON representation of a simple error value, containing only a message and an error code.
|
||||
type DefaultErrorJson struct {
|
||||
// DefaultJsonError is a JSON representation of a simple error value, containing only a message and an error code.
|
||||
type DefaultJsonError struct {
|
||||
Message string `json:"message"`
|
||||
Code int `json:"code"`
|
||||
}
|
||||
|
||||
func (e *DefaultErrorJson) StatusCode() int {
|
||||
func (e *DefaultJsonError) StatusCode() int {
|
||||
return e.Code
|
||||
}
|
||||
|
||||
func (e *DefaultErrorJson) Error() string {
|
||||
func (e *DefaultJsonError) Error() string {
|
||||
return fmt.Sprintf("HTTP request unsuccessful (%d: %s)", e.Code, e.Message)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user