Read settings from config file (#714)
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE TypeSynonymInstances #-}
|
||||
|
||||
module PostgREST.Error (pgErrResponse, errResponse) where
|
||||
module PostgREST.Error (pgErrResponse, errResponse, prettyUsageError) where
|
||||
|
||||
import Protolude
|
||||
import Data.Aeson ((.=))
|
||||
@@ -29,6 +29,11 @@ pgErrResponse authed e =
|
||||
else [jsonType] in
|
||||
responseLBS status hdrs (JSON.encode e)
|
||||
|
||||
prettyUsageError :: P.UsageError -> Text
|
||||
prettyUsageError (P.ConnectionError e) =
|
||||
"Database connection error:\n" <> toS (fromMaybe "" e)
|
||||
prettyUsageError e = show $ JSON.encode e
|
||||
|
||||
instance JSON.ToJSON P.UsageError where
|
||||
toJSON (P.ConnectionError e) = JSON.object [
|
||||
"code" .= ("" :: Text),
|
||||
|
||||
Reference in New Issue
Block a user