in pkg/cloud_provider/lustre/lustre.go [473:495]
func existingErrorCode(err error) *codes.Code {
if err == nil {
return nil
}
var te *common.TemporaryError
// explicitly check if the error type is a `common.TemporaryError`.
if errors.As(err, &te) {
if status, ok := status.FromError(err); ok {
return errCodePtr(status.Code())
}
}
// We want to make sure we catch other error types that are statusable.
// (eg. grpc-go/internal/status/status.go Error struct that wraps a status)
var googleErr *googleapi.Error
if !errors.As(err, &googleErr) {
if status, ok := status.FromError(err); ok {
return errCodePtr(status.Code())
}
}
return nil
}