Skip to content

Commit

Permalink
HttpCode -> HTTPCode per CI warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Cassandra Coyle <[email protected]>
  • Loading branch information
cicoyle committed Dec 11, 2023
1 parent 8ec73ae commit f4e3543
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import (
"fmt"
"net/http"

"github.com/dapr/kit/logger"
"google.golang.org/genproto/googleapis/rpc/errdetails"
grpcCodes "google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/runtime/protoiface"

"github.com/dapr/kit/logger"
)

var log = logger.NewLogger("dapr.kit")
Expand All @@ -40,7 +41,7 @@ type Error struct {
GrpcCode grpcCodes.Code

// Status code for HTTP responses.
HttpCode int
HTTPCode int

// Message is the human-readable error message.
Message string
Expand All @@ -55,7 +56,7 @@ func New(grpcCode grpcCodes.Code, httpCode int, message string, tag string) *Err
kitError := &Error{
Details: make([]proto.Message, 0),
GrpcCode: grpcCode,
HttpCode: httpCode,
HTTPCode: httpCode,
Message: message,
Tag: tag,
}
Expand Down Expand Up @@ -187,7 +188,7 @@ func (e *Error) JSONErrorValue() []byte {
// This will get overwritten later if there is an ErrorInfo code
httpStatus := e.Tag
if httpStatus == "" {
httpStatus = http.StatusText(e.HttpCode)
httpStatus = http.StatusText(e.HTTPCode)
}

errJSON := ErrorJSON{
Expand Down Expand Up @@ -349,5 +350,5 @@ func (e *Error) Is(targetI error) bool {
}
return e.Tag == target.Tag &&
e.GrpcCode == target.GrpcCode &&
e.HttpCode == target.HttpCode
e.HTTPCode == target.HTTPCode
}
6 changes: 3 additions & 3 deletions errors/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ func TestError_HttpCode(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
kitErr := Error{
HttpCode: tt.fields.httpCode,
HTTPCode: tt.fields.httpCode,
}
if got := kitErr.HttpCode; got != tt.want {
t.Errorf("Error.HttpCode = %v, want %v", got, tt.want)
if got := kitErr.HTTPCode; got != tt.want {
t.Errorf("Error.HTTPCode = %v, want %v", got, tt.want)
}
assert.True(t, kitErr.Is(&kitErr))
})
Expand Down

0 comments on commit f4e3543

Please sign in to comment.