Skip to content

Commit

Permalink
wip: error debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Clement Liaw committed Jan 3, 2025
1 parent c62c317 commit 9c48251
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"k8s.io/klog/v2"

Check failure on line 8 in internal/common/util.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
"math"
"net/http"
"strings"
Expand Down Expand Up @@ -130,10 +131,12 @@ func GetAsyncOperationResult[T any](ctx context.Context, op *crusoeapi.Operation
// additional information which is present in the response. The error
// is returned unchanged if it cannot be unpacked.
func UnpackSwaggerErr(original error) error {
klog.Infof("original error: %s", original)
swagErr := &crusoeapi.GenericSwaggerError{}
if ok := errors.As(original, swagErr); !ok {
return original
}
klog.Infof("swagger error: %s", swagErr.Error())

var model crusoeapi.ErrorBody
err := json.Unmarshal(swagErr.Body(), &model)
Expand Down

0 comments on commit 9c48251

Please sign in to comment.