Skip to content

Commit

Permalink
update status code if action returns error (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShubhamGupta9582 committed Jan 6, 2021
1 parent b7123e8 commit 17d5563
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions whisk/activation.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,28 @@ func (s *ActivationService) Get(activationID string) (*Activation, *http.Respons
return nil, resp, err
}

a.StatusCode = GetStatusCodeForMessage(a.Status)

return a, resp, nil
}

func GetStatusCodeForMessage(msg string) int {
var code int

switch msg {
case "application error":
code = 1
case "action developer error":
code = 2
case "whisk internal error":
code = 3
default:
code = 0
}

return code
}

func (s *ActivationService) Logs(activationID string) (*Activation, *http.Response, error) {
// TODO :: for some reason /activations/:id/logs only works with "_" as namespace
s.client.Namespace = "_"
Expand Down

0 comments on commit 17d5563

Please sign in to comment.