mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-04-22 02:37:43 +02:00
Move Exception to its own module
This will avoid cycles later.
This commit is contained in:
parent
37343fa533
commit
dc033e1331
19
src/Yesod/Auth/OAuth2/Exception.hs
Normal file
19
src/Yesod/Auth/OAuth2/Exception.hs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{-# LANGUAGE DeriveDataTypeable #-}
|
||||||
|
|
||||||
|
module Yesod.Auth.OAuth2.Exception
|
||||||
|
( YesodOAuth2Exception(..)
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Control.Exception.Safe
|
||||||
|
import qualified Data.ByteString.Lazy as BL
|
||||||
|
import Data.Text (Text)
|
||||||
|
|
||||||
|
-- | Provider name and error
|
||||||
|
--
|
||||||
|
-- The error is a lazy bytestring because it's most often encoded JSON.
|
||||||
|
--
|
||||||
|
-- Deprecated. Eventually, we'll return @Either@s all the way up.
|
||||||
|
--
|
||||||
|
data YesodOAuth2Exception = InvalidProfileResponse Text BL.ByteString
|
||||||
|
deriving (Show, Typeable)
|
||||||
|
instance Exception YesodOAuth2Exception
|
||||||
@ -1,5 +1,3 @@
|
|||||||
{-# LANGUAGE DeriveDataTypeable #-}
|
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE TupleSections #-}
|
{-# LANGUAGE TupleSections #-}
|
||||||
-- |
|
-- |
|
||||||
@ -8,10 +6,9 @@
|
|||||||
-- implementations. May also be useful for writing local providers.
|
-- implementations. May also be useful for writing local providers.
|
||||||
--
|
--
|
||||||
module Yesod.Auth.OAuth2.Prelude
|
module Yesod.Auth.OAuth2.Prelude
|
||||||
( YesodOAuth2Exception(..)
|
(
|
||||||
|
-- * Provider helpers
|
||||||
-- * Provider helpers
|
authGetProfile
|
||||||
, authGetProfile
|
|
||||||
, scopeParam
|
, scopeParam
|
||||||
, setExtra
|
, setExtra
|
||||||
|
|
||||||
@ -55,6 +52,7 @@ module Yesod.Auth.OAuth2.Prelude
|
|||||||
, module URI.ByteString.Extension
|
, module URI.ByteString.Extension
|
||||||
|
|
||||||
-- * Temporary, until I finish re-structuring modules
|
-- * Temporary, until I finish re-structuring modules
|
||||||
|
, YesodOAuth2Exception(..)
|
||||||
, authOAuth2
|
, authOAuth2
|
||||||
, authOAuth2Widget
|
, authOAuth2Widget
|
||||||
) where
|
) where
|
||||||
@ -74,16 +72,7 @@ import URI.ByteString
|
|||||||
import URI.ByteString.Extension
|
import URI.ByteString.Extension
|
||||||
import Yesod.Auth
|
import Yesod.Auth
|
||||||
import Yesod.Auth.OAuth2
|
import Yesod.Auth.OAuth2
|
||||||
|
import Yesod.Auth.OAuth2.Exception
|
||||||
-- | Provider name and error
|
|
||||||
--
|
|
||||||
-- The error is a lazy bytestring because it's most often encoded JSON.
|
|
||||||
--
|
|
||||||
-- Deprecated. Eventually, we'll return @Either@s all the way up.
|
|
||||||
--
|
|
||||||
data YesodOAuth2Exception = InvalidProfileResponse Text BL.ByteString
|
|
||||||
deriving (Show, Typeable)
|
|
||||||
instance Exception YesodOAuth2Exception
|
|
||||||
|
|
||||||
-- | Retrieve a user's profile as JSON
|
-- | Retrieve a user's profile as JSON
|
||||||
--
|
--
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user