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:
co-authored by
Emil Tullstedt
parent
0cb29d337a
commit
294770f411
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user