mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 03:01:19 +00:00
20 lines
449 B
Go
20 lines
449 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"github.com/ethereum/go-ethereum/log"
|
||
|
)
|
||
|
|
||
|
// HandleServiceErrors manages a goroutine that listens for errors broadcast to
|
||
|
// this service's error channel. This serves as a final step for error logging
|
||
|
// and is stopped upon the service shutting down.
|
||
|
func HandleServiceErrors(done <-chan struct{}, errChan <-chan error) {
|
||
|
for {
|
||
|
select {
|
||
|
case <-done:
|
||
|
return
|
||
|
case err := <-errChan:
|
||
|
log.Error(err.Error())
|
||
|
}
|
||
|
}
|
||
|
}
|