[CHEF-4703] Refactor handle_command_failures method.

`return` instead of nesting `if` or `unless`