Skip to content

Commit

Permalink
fix(go): better network error (#3943)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Oct 10, 2024
1 parent 4f5b162 commit ed203c6
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package errs

import (
"errors"
"fmt"
)

var ErrNoMoreHostToTry = NewNoMoreHostToTryError()

type NoMoreHostToTryError struct {
Expand All @@ -17,5 +22,8 @@ func (e *NoMoreHostToTryError) IntermediateNetworkErrors() []error {
}

func (e *NoMoreHostToTryError) Error() string {
if len(e.intermediateNetworkErrors) > 0 {
return fmt.Errorf("all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. %w", errors.Join(e.intermediateNetworkErrors...)).Error()
}
return "all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate."
}

0 comments on commit ed203c6

Please sign in to comment.