handleError
  :: Status
  -> ResponseHeaders
  -> BS.ByteString
  -> APIError
handleError _ headers _ =
  case decode $ BSL.fromChunks [fromMaybe "{}" (lookup "X-Response-Body-Start" headers)] of
    Just e  -> mapError e
    Nothing -> CallError "unknown"
handleError
  :: Status
  -> ResponseHeaders
  -> BS.ByteString
  -> APIError
handleError _ headers _ =
  case decode $ BSL.fromChunks [fromMaybe "{}" (lookup "X-Response-Body-Start" headers)] of
    Just e  -> mapError e
    Nothing -> CallError "unknown"
handleError _ headers _ =
  case decode $ BSL.fromChunks [fromMaybe "{}" (lookup "X-Response-Body-Start" headers)] of
    Just e  -> mapError e
    Nothing -> CallError "unknown"