From d395bb60522aa228a534d9181339519f171fe6b2 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 2 Oct 2020 19:54:50 +0200 Subject: [PATCH] Fix error messages on connection failure for postgres on localized Windows --- CHANGELOG.md | 1 + src/PostgREST/Error.hs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daa7d6603..9484358eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #1530, Fix how the PostgREST version is shown in the help text when the `.git` directory is not available - @monacoremo - #1094, Fix expired JWTs starting an empty transaction on the db - @steve-chavez - #1475, Fix location header for POST request with select= without PK (#1162) - @wolfgangwalther + - #1599, Fix error messages on connection failure for localized postgres on Windows (#1585) - @wolfgangwalther ### Changed diff --git a/src/PostgREST/Error.hs b/src/PostgREST/Error.hs index 174b02b4b..03a4d86ee 100644 --- a/src/PostgREST/Error.hs +++ b/src/PostgREST/Error.hs @@ -28,7 +28,7 @@ import Network.HTTP.Types.Header import PostgREST.Types import Protolude hiding (toS) -import Protolude.Conv (toS) +import Protolude.Conv (toS, toSL) class (JSON.ToJSON a) => PgrstError a where @@ -133,7 +133,7 @@ instance JSON.ToJSON P.UsageError where toJSON (P.ConnectionError e) = JSON.object [ "code" .= ("" :: Text), "message" .= ("Database connection error. Retrying the connection." :: Text), - "details" .= (toS $ fromMaybe "" e :: Text)] + "details" .= (toSL $ fromMaybe "" e :: Text)] toJSON (P.SessionError e) = JSON.toJSON e -- H.Error instance JSON.ToJSON H.QueryError where