-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add panic recovers #1251
Add panic recovers #1251
Conversation
Resolves #263 Adds recovery functions in main loop of conduit as well as in a go-routine in the start function of the pipeline
Codecov Report
@@ Coverage Diff @@
## conduit #1251 +/- ##
===========================================
- Coverage 62.06% 62.05% -0.01%
===========================================
Files 70 71 +1
Lines 9434 9440 +6
===========================================
+ Hits 5855 5858 +3
- Misses 3073 3075 +2
- Partials 506 507 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
cmd/conduit/main.go
Outdated
defer func() { | ||
if r := recover(); r != nil { | ||
logger.Fatalf("conduit framework experienced a panic: %v", r) | ||
} | ||
}() |
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.
Do you think it's worth making a helper function? I'm thinking that could be something we document / reuse in plugins.
func HandlePanicAndFail(logger *log.Logger) {
if r := recover(); r != nil {
logger.Panicf("conduit framework experienced a panic: %v", r)
}
}
Also, it looks like logrus has a "Panic" level. The difference compared to Fatal is that it calls panic after logging instead of Exit.
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.
Re-worked, let me know what you think.
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.
LGTM
Resolves #263
Adds recovery functions in main loop of conduit as well as in a go-routine in the start function of the pipeline
Summary
Explain the goal of this change and what problem it is solving. Format this cleanly so that it may be used for a commit message, as your changes will be squash-merged.
Test Plan
How did you test these changes? Please provide the exact scenarios you tested in as much detail as possible including commands, output and rationale.