Skip to content

Commit 4a8adae

Browse files
committed
fix: unseccessful HTTP now returns proper error
Signed-off-by: Plamen Petrov <[email protected]>
1 parent 006fb79 commit 4a8adae

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
@@ -1916,7 +1916,7 @@ func (s *service) PauseVM(ctx context.Context, req *proto.PauseVMRequest) (*empt
19161916
}
19171917
if !strings.Contains(resp.Status, "204") {
19181918
s.logger.WithError(err).Error("Failed to pause VM")
1919-
return nil, err
1919+
return nil, errors.New("Failed to pause VM")
19201920
}
19211921

19221922
return &empty.Empty{}, nil
@@ -1937,7 +1937,7 @@ func (s *service) ResumeVM(ctx context.Context, req *proto.ResumeVMRequest) (*em
19371937
}
19381938
if !strings.Contains(resp.Status, "204") {
19391939
s.logger.WithError(err).Error("Failed to resume VM")
1940-
return nil, err
1940+
return nil, errors.New("Failed to resume VM")
19411941
}
19421942
return &empty.Empty{}, nil
19431943
}
@@ -1973,7 +1973,7 @@ func (s *service) LoadSnapshot(ctx context.Context, req *proto.LoadSnapshotReque
19731973
if !strings.Contains(resp.Status, "204") {
19741974
s.logger.WithError(err).Error("Failed to load VM from snapshot")
19751975
s.logger.WithError(err).Errorf("Status of request: %s", resp.Status)
1976-
return nil, err
1976+
return nil, errors.New("Failed to load VM from snapshot")
19771977
}
19781978

19791979
return &proto.LoadResponse{FirecrackerPID: strconv.Itoa(s.firecrackerPid)}, nil
@@ -1994,7 +1994,7 @@ func (s *service) CreateSnapshot(ctx context.Context, req *proto.CreateSnapshotR
19941994
}
19951995
if !strings.Contains(resp.Status, "204") {
19961996
s.logger.WithError(err).Error("Failed to make snapshot of VM")
1997-
return nil, err
1997+
return nil, errors.New("Failed to make snapshot of VM")
19981998
}
19991999

20002000
return &empty.Empty{}, nil

0 commit comments

Comments
 (0)