Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: Emilia Haligowska <[email protected]>
  • Loading branch information
ehaligow committed Jan 4, 2024
1 parent 759d894 commit d92972a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions svc-api/handle/chassis.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,26 @@ func (chassis *ChassisRPCs) UpdateChassisResource(ctx iris.Context) {
e := ctx.ReadJSON(requestBody)
if e != nil {
errorMessage := "error while trying to read obligatory json body: " + e.Error()
log.Println(errorMessage)
log.Warn(errorMessage)
response := common.GeneralError(http.StatusBadRequest, response.MalformedJSON, errorMessage, nil, nil)
common.SetResponseHeader(ctx, response.Header)
ctx.StatusCode(http.StatusBadRequest)
ctx.JSON(&response.Body)
return
}
rr, rerr := chassis.UpdateChassisResourceRPC(chassisproto.UpdateChassisResourceRequest{
rpcResponse, err := chassis.UpdateChassisResourceRPC(chassisproto.UpdateChassisResourceRequest{
SessionToken: ctx.Request().Header.Get("X-Auth-Token"),
URL: ctx.Request().RequestURI,
RequestBody: *requestBody,
})

if rerr != nil {
log.Println("RPC error:" + rerr.Error())
re := common.GeneralError(http.StatusInternalServerError, response.InternalError, rerr.Error(), nil, nil)
if err != nil {
log.Println("RPC error:" + err.Error())
re := common.GeneralError(http.StatusInternalServerError, response.InternalError, err.Error(), nil, nil)
writeResponse(ctx, re.Header, re.StatusCode, re.Body)
return
}

writeResponse(ctx, rr.Header, rr.StatusCode, rr.Body)
writeResponse(ctx, rpcResponse.Header, rpcResponse.StatusCode, rpcResponse.Body)

}
}
2 changes: 1 addition & 1 deletion svc-api/rpc/chassis.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func UpdateChassisResource(req chassisproto.UpdateChassisResourceRequest) (*chas

resp, err := service.UpdateChassisResource(context.TODO(), &req)
if err != nil && resp == nil {
return nil, fmt.Errorf("error: something went wrong with rpc call: %v", err)
return nil, fmt.Errorf("Something went wrong with rpc call: %v", err)
}

return resp, err
Expand Down

0 comments on commit d92972a

Please sign in to comment.