mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 22:24:31 +08:00
Postgres: Improve invalid port specifier error during health check (#105536)
normalize error message in postgres invalid port specifier error
This commit is contained in:
@ -81,6 +81,12 @@ func ErrToHealthCheckResult(err error) (*backend.CheckHealthResult, error) {
|
||||
details["verboseMessage"] = pqErr.Message
|
||||
}
|
||||
}
|
||||
if errors.Is(err, ErrInvalidPortSpecified) {
|
||||
res.Message = fmt.Sprintf("Connection string error: %s", ErrInvalidPortSpecified.Error())
|
||||
if unwrappedErr := errors.Unwrap(err); unwrappedErr != nil {
|
||||
details["verboseMessage"] = unwrappedErr.Error()
|
||||
}
|
||||
}
|
||||
detailBytes, marshalErr := json.Marshal(details)
|
||||
if marshalErr != nil {
|
||||
return res, nil
|
||||
|
Reference in New Issue
Block a user