Skip to content

Commit

Permalink
Merge pull request #13 from surajsub/master
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
surajsub authored May 5, 2020
2 parents ca58b3f + ce26c4f commit 5d6eb33
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 34 deletions.
33 changes: 0 additions & 33 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,6 @@ func ToError(err error) error {
return nil
}

/*
fmt.Println(reflect.TypeOf(err))
v, isAPIError := err.(*runtime.APIError)
if isAPIError {
response := reflect.ValueOf(v.Response)
fun := response.MethodByName("Body")
retvals := fun.Call([]reflect.Value{})
body, _ := retvals[0].Interface().(io.ReadCloser)
var bodyBytes []byte
if body != nil {
bodyBytes, _ = ioutil.ReadAll(body)
}
var payload models.Riaaserror
berr := json.Unmarshal(bodyBytes, &payload)
if berr != nil {
return errors.New(string(bodyBytes))
}
return RiaasError{
Payload: &payload,
}
}
*/

// check if its ours
kind := reflect.TypeOf(err).Kind()
if kind != reflect.Ptr {
Expand Down Expand Up @@ -99,15 +75,6 @@ func ToError(err error) error {
return err
}

//if len(payload.Errors) == 0 {
// return nil
//}

//if len(payload.Errors) == 1 && payload.Errors[0].Code == "unexpected_return_value" {
// statuscode := reflect.ValueOf(err).Elem().FieldByName("_statusCode")
// payload.Errors[0].Target.Name = strconv.Itoa(int(statuscode.Int()))
// payload.Errors[0].Target.Type = "http_code"
//}
var reterr = Error{
Payload: &payload,
}
Expand Down
2 changes: 1 addition & 1 deletion helpers/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
PIInstanceReplicationScheme = "pi_replication_scheme"
PIInstanceProgress = "pi_progress"
PIInstanceUserData = "pi_user_data"
PIInstancePinPolicy = "pi_pinpolicy"
PIInstancePinPolicy = "pi_pin_policy"

// IBM PI Volume
PIVolumeName = "pi_volume_name"
Expand Down

0 comments on commit 5d6eb33

Please sign in to comment.