PostgreSQL: Remove feature toggle postgresDSUsePGX (#113675)
* PostgreSQL: Remove feature toggle `postgresDSUsePGX` * Fix tests and linting * Address review comments
This commit is contained in:
@@ -10,11 +10,10 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
"github.com/lib/pq"
|
||||
)
|
||||
|
||||
func (e *DataSourceHandler) CheckHealth(ctx context.Context, req *backend.CheckHealthRequest) (*backend.CheckHealthResult, error) {
|
||||
err := e.Ping()
|
||||
err := e.Ping(ctx)
|
||||
if err != nil {
|
||||
logCheckHealthError(ctx, e.dsInfo, err)
|
||||
if strings.EqualFold(req.PluginContext.User.Role, "Admin") {
|
||||
@@ -64,24 +63,6 @@ func ErrToHealthCheckResult(err error) (*backend.CheckHealthResult, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if errors.Is(err, pq.ErrSSLNotSupported) {
|
||||
res.Message = "SSL error: Failed to connect to the server"
|
||||
}
|
||||
if strings.HasPrefix(err.Error(), "pq") {
|
||||
res.Message = "Database error: Failed to connect to the postgres server"
|
||||
if unwrappedErr := errors.Unwrap(err); unwrappedErr != nil {
|
||||
details["verboseMessage"] = unwrappedErr.Error()
|
||||
}
|
||||
}
|
||||
var pqErr *pq.Error
|
||||
if errors.As(err, &pqErr) {
|
||||
if pqErr != nil {
|
||||
if pqErr.Code != "" {
|
||||
res.Message += fmt.Sprintf(". Postgres error code: %s", pqErr.Code.Name())
|
||||
}
|
||||
details["verboseMessage"] = pqErr.Message
|
||||
}
|
||||
}
|
||||
if errors.Is(err, ErrParsingPostgresURL) {
|
||||
res.Message = fmt.Sprintf("Connection string error: %s", ErrParsingPostgresURL.Error())
|
||||
if unwrappedErr := errors.Unwrap(err); unwrappedErr != nil {
|
||||
|
||||
Reference in New Issue
Block a user