Skip to content

Commit 766ec09

Browse files
authored
Fix http error codes (kubeflow#125)
* core: rearrange fields to reduce struct size Signed-off-by: Isabella do Amaral <[email protected]> * ignore debug files Signed-off-by: Isabella do Amaral <[email protected]> * api: fix http status error conversion Signed-off-by: Isabella do Amaral <[email protected]> --------- Signed-off-by: Isabella do Amaral <[email protected]>
1 parent e4cdc0a commit 766ec09

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
# Test binary, built with `go test -c`
1212
*.test
1313

14+
__debug*
15+
1416
# Output of the go coverage tool, specifically when used with LiteIDE
1517
*.out
1618

pkg/api/error.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var (
1111
)
1212

1313
func ErrToStatus(err error) int {
14-
switch err {
14+
switch errors.Unwrap(err) {
1515
case ErrBadRequest:
1616
return http.StatusBadRequest
1717
case ErrNotFound:

pkg/core/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
// ModelRegistryService is the core library of the model registry
2121
type ModelRegistryService struct {
2222
mlmdClient proto.MetadataStoreServiceClient
23-
nameConfig mlmdtypes.MLMDTypeNamesConfig
2423
typesMap map[string]int64
2524
mapper *mapper.Mapper
2625
openapiConv *generated.OpenAPIConverterImpl
26+
nameConfig mlmdtypes.MLMDTypeNamesConfig
2727
}
2828

2929
// NewModelRegistryService creates a new instance of the ModelRegistryService, initializing it with the provided gRPC client connection.

0 commit comments

Comments
 (0)