Skip to content

Commit 4519171

Browse files
plamenmpetrovamohoste
authored andcommitted
fix: unseccessful HTTP now returns proper error
Signed-off-by: Plamen Petrov <[email protected]>
1 parent ac56657 commit 4519171

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

runtime/service.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ func (s *service) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empt
19391939
}
19401940
if !strings.Contains(resp.Status, "204") {
19411941
s.logger.WithError(err).Error("Failed to pause VM")
1942-
return nil, err
1942+
return nil, errors.New("Failed to pause VM")
19431943
}
19441944

19451945
return &empty.Empty{}, nil
@@ -1960,7 +1960,7 @@ func (s *service) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*em
19601960
}
19611961
if !strings.Contains(resp.Status, "204") {
19621962
s.logger.WithError(err).Error("Failed to resume VM")
1963-
return nil, err
1963+
return nil, errors.New("Failed to resume VM")
19641964
}
19651965
return &empty.Empty{}, nil
19661966
}
@@ -1996,7 +1996,7 @@ func (s *service) LoadSnapshot(ctx context.Context, req *proto.LoadSnapshotReque
19961996
if !strings.Contains(resp.Status, "204") {
19971997
s.logger.WithError(err).Error("Failed to load VM from snapshot")
19981998
s.logger.WithError(err).Errorf("Status of request: %s", resp.Status)
1999-
return nil, err
1999+
return nil, errors.New("Failed to load VM from snapshot")
20002000
}
20012001

20022002
return &proto.LoadResponse{FirecrackerPID: strconv.Itoa(s.firecrackerPid)}, nil
@@ -2017,7 +2017,7 @@ func (s *service) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotR
20172017
}
20182018
if !strings.Contains(resp.Status, "204") {
20192019
s.logger.WithError(err).Error("Failed to make snapshot of VM")
2020-
return nil, err
2020+
return nil, errors.New("Failed to make snapshot of VM")
20212021
}
20222022

20232023
return &empty.Empty{}, nil

0 commit comments

Comments
 (0)