mirror of
https://github.com/umputun/reproxy.git
synced 2024-08-16 12:10:31 +03:00
defer recover
This commit is contained in:
parent
3cb546b015
commit
546c2609b0
13
app/main.go
13
app/main.go
@ -160,11 +160,6 @@ func run() error {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
go func() {
|
||||
if x := recover(); x != nil {
|
||||
log.Printf("[WARN] run time panic:\n%v", x)
|
||||
panic(x)
|
||||
}
|
||||
|
||||
// catch signal and invoke graceful termination
|
||||
stop := make(chan os.Signal, 1)
|
||||
signal.Notify(stop, os.Interrupt, syscall.SIGTERM)
|
||||
@ -173,6 +168,14 @@ func run() error {
|
||||
cancel()
|
||||
}()
|
||||
|
||||
defer func() {
|
||||
// handle panic
|
||||
if x := recover(); x != nil {
|
||||
log.Printf("[WARN] run time panic:\n%v", x)
|
||||
panic(x)
|
||||
}
|
||||
}()
|
||||
|
||||
providers, err := makeProviders()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to make providers: %w", err)
|
||||
|
Loading…
Reference in New Issue
Block a user