-
Notifications
You must be signed in to change notification settings - Fork 558
Replace log.Fatal by return errors in deploy.go #3116
Replace log.Fatal by return errors in deploy.go #3116
Conversation
413fccd
to
8d34236
Compare
@@ -159,20 +159,21 @@ func (dc *deployCmd) load(cmd *cobra.Command, args []string) error { | |||
return fmt.Errorf("failed to get client: %s", err.Error()) | |||
} | |||
|
|||
// autofillApimodel calls log.Fatal() directly and does not return errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not anymore 😈
|
||
err = autofillApimodel(deployCmd) | ||
if err != nil { | ||
t.Fatalf("unexpected error autofilling the example apimodel: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the last line of defense? (i.e., no return err?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/me takes off beer goggles
/approve |
Codecov Report
@@ Coverage Diff @@
## master #3116 +/- ##
==========================================
- Coverage 51.89% 51.89% -0.01%
==========================================
Files 99 99
Lines 15162 15164 +2
==========================================
+ Hits 7869 7870 +1
- Misses 6571 6572 +1
Partials 722 722 |
|
||
// cleanup, since auto-populations creates dirs and saves the SSH private key that it might create | ||
defer os.RemoveAll(deployCmd.outputDirectory) | ||
|
||
cs, _, err = validateApimodel(apiloader, cs, ver) | ||
if err != nil { | ||
log.Fatalf("unexpected error validating apimodel after populating defaults: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackfrancis you actually just made me realize this should be t
not log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I changed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O.K. beer googles worked!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍻
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it: Return errors instead of doing
log.Fatal
inside functionsWhich issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
If applicable:
Release note: