Created
January 15, 2016 19:50
-
-
Save codedmart/78bf57eb2f508b9d11aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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