Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the error message instead of the error object #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions prober/prober.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ type Result struct {

// ProbeResult is the data structure used to retain the data fetched from a single probe
type ProbeResult struct {
Name string `json:"name"`
Healthy bool `json:"healthy"`
Comment string `json:"comment"`
Error error `json:"error"`
Duration time.Duration `json:"duration"`
Name string `json:"name"`
Healthy bool `json:"healthy"`
Comment string `json:"comment"`
Error error `json:"-"`
ErrorMessage string `json:"error"`
Duration time.Duration `json:"duration"`
}

// NewProber is the default constructor of a Prober
Expand Down Expand Up @@ -152,6 +153,9 @@ func (p *Prober) CheckOneProbe(ctx context.Context, probe Probe, res chan *Probe
Error: err,
Duration: duration,
}
if err != nil {
probeResult.ErrorMessage = err.Error()
}

res <- probeResult
}
Expand Down