on master help sign in
include the HttpException in DockerConnectionError
commitb9d7100a24a5b64752078eb224d255a0ad62b184 authorJames Parker <dev@jamesparker.me> dateThu 9 Mar 2017, 21:14 (10 years ago) parent70ad6dd
1 file changed+4−4
src/Docker/Client/Http.hs+4−4
src/Docker/Client/Http.hs+4−4
@@ -52,12 +52,12 @@ type Response = HTTP.Response BL.ByteString
5252type HttpVerb = StdMethod
5353newtype HttpHandler m = HttpHandler (forall a . Request -> (HTTP.Response () -> Sink BSC.ByteString m (Either DockerError a)) -> m (Either DockerError a))
5454
55−data DockerError = DockerConnectionError
55+data DockerError = DockerConnectionError NHS.HttpException
5656 | DockerInvalidRequest Endpoint
5757 | DockerClientError Text
5858 | DockerClientDecodeError Text -- ^ Could not parse the response from the Docker endpoint.
5959 | DockerInvalidStatusCode HTTP.Status -- ^ Invalid exit code received from Docker endpoint.
60− | GenericDockerError Text deriving (Eq, Show, Typeable)
60+ | GenericDockerError Text deriving (Show, Typeable)
6161
6262newtype DockerT m a = DockerT {
6363 unDockerT :: Monad m => ReaderT (DockerClientOpts, HttpHandler m) m a
@@ -114,8 +114,8 @@ httpHandler manager = HttpHandler $ \request' sink -> do -- runResourceT ..
114114 let request = NHS.setRequestManager manager request'
115115 try (NHS.httpSink request sink) >>= \res -> case res of
116116 Right res -> return res
117− Left HTTP.FailedConnectionException{} -> return $ Left DockerConnectionError
118− Left HTTP.FailedConnectionException2{} -> return $ Left DockerConnectionError
117+ Left e@HTTP.FailedConnectionException{} -> return $ Left $ DockerConnectionError e
118+ Left e@HTTP.FailedConnectionException2{} -> return $ Left $ DockerConnectionError e
119119 Left e -> return $ Left $ GenericDockerError (T.pack $ show e)
120120
121121-- | Connect to a unix domain socket (the default docker socket is