mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-10 19:51:20 +00:00
f5e5287082
Former-commit-id: 2ec35880b3aa30d3c217815c9a474e8d81ee1fa8 [formerly c20da02cf9149990f8b7913cfe426b8036992c16] Former-commit-id: 4851374829557f1523f5994b1d97e08e46979aed
20 lines
444 B
Go
20 lines
444 B
Go
package utils
|
|
|
|
import (
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// 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())
|
|
}
|
|
}
|
|
}
|