Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created January 15, 2016 19:50
Show Gist options
  • Save codedmart/78bf57eb2f508b9d11aa to your computer and use it in GitHub Desktop.
Save codedmart/78bf57eb2f508b9d11aa to your computer and use it in GitHub Desktop.
authUser :: UserParams -> App ShotgunParams
authUser userParams = do
AppConfig _ as <- ask
let sParams = shotgunLogin userParams
r <- liftIO $ postWith defOpts (unpack $ shotgunUrl as) (toJSON sParams) `E.catch` handler
return sParams
where
handler :: HttpException -> App a
handler e@(StatusCodeException _ _ _) = serverErr $ ServerError "Oops!"
-- Couldn't match type ‘App a0’
-- with ‘IO (Response Data.ByteString.Lazy.Internal.ByteString)’
-- Expected type: HttpException
-- -> IO (Response Data.ByteString.Lazy.Internal.ByteString)
-- Actual type: HttpException -> App a0
-- In the second argument of ‘catch’, namely ‘handler’
-- In the second argument of ‘($)’, namely
-- ‘postWith defOpts (unpack $ shotgunUrl as) (toJSON sParams)
-- `catch` handler’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment