Proposal for binary output (#802)

This commit is contained in:
Steve Chávez
2017-02-14 20:36:51 -08:00
committed by Joe Nelson
parent 84f68c68cb
commit 98438c437f
10 changed files with 110 additions and 23 deletions
+15 -1
View File
@@ -2,7 +2,16 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
module PostgREST.Error (apiRequestErrResponse, pgErrResponse, errResponse, prettyUsageError, singularityError, formatGeneralError, formatParserError) where
module PostgREST.Error (
apiRequestErrResponse
, pgErrResponse
, errResponse
, prettyUsageError
, singularityError
, binaryFieldError
, formatGeneralError
, formatParserError
) where
import Protolude
import Data.Aeson ((.=))
@@ -54,6 +63,11 @@ singularityError numRows =
, toS (toMime CTSingularJSON), "requires 1 row"
]
binaryFieldError :: Response
binaryFieldError =
errResponse HT.status406 (toS (toMime CTOctetStream) <>
" requested but a single column was not selected")
formatParserError :: ParseError -> Text
formatParserError e = formatGeneralError message details
where