Files
virtual-kubelet/providers/azure/errors.go
Brian Goff cd42fdd7b8 Use strongerrors in provider implementations. (#403)
This ensures that we can catch certain types of errors from providers
and handle accordingly in the core. There is still more to do here to
improve that but this resolves an immediate need to know why a Delete
failed.

vic provider was not updated since I could not figure out where to get
this information.
2018-11-07 16:02:48 -08:00

27 lines
385 B
Go

package azure
import (
"net/http"
"github.com/cpuguy83/strongerrors"
"github.com/virtual-kubelet/virtual-kubelet/providers/azure/client/api"
)
func wrapError(err error) error {
if err == nil {
return nil
}
e, ok := err.(*api.Error)
if !ok {
return err
}
switch e.StatusCode {
case http.StatusNotFound:
return strongerrors.NotFound(err)
default:
return err
}
}