Chore: Handle wrapped errors (#29223)

* Chore: Handle wrapped errors

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
Arve Knudsen
2020-11-19 13:34:28 +01:00
committed by GitHub
co-authored by Emil Tullstedt
parent 0cb29d337a
commit 294770f411
34 changed files with 153 additions and 124 deletions
+2 -2
View File
@@ -187,7 +187,7 @@ func (s *Server) Run() (err error) {
// Mark that we are in shutdown mode
// So no more services are started
s.shutdownInProgress = true
if err != context.Canceled {
if !errors.Is(err, context.Canceled) {
// Server has crashed.
s.log.Error("Stopped "+descriptor.Name, "reason", err)
} else {
@@ -234,7 +234,7 @@ func (s *Server) Shutdown(reason string) {
func (s *Server) ExitCode(reason error) int {
code := 1
if reason == context.Canceled && s.shutdownReason != "" {
if errors.Is(reason, context.Canceled) && s.shutdownReason != "" {
reason = fmt.Errorf(s.shutdownReason)
code = 0
}