mirror of
https://github.com/freckle/yesod-auth-oauth2.git
synced 2026-01-11 19:58:28 +01: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 TupleSections #-}
|
||||
-- |
|
||||
@ -8,10 +6,9 @@
|
||||
-- implementations. May also be useful for writing local providers.
|
||||
--
|
||||
module Yesod.Auth.OAuth2.Prelude
|
||||
( YesodOAuth2Exception(..)
|
||||
|
||||
-- * Provider helpers
|
||||
, authGetProfile
|
||||
(
|
||||
-- * Provider helpers
|
||||
authGetProfile
|
||||
, scopeParam
|
||||
, setExtra
|
||||
|
||||
@ -55,6 +52,7 @@ module Yesod.Auth.OAuth2.Prelude
|
||||
, module URI.ByteString.Extension
|
||||
|
||||
-- * Temporary, until I finish re-structuring modules
|
||||
, YesodOAuth2Exception(..)
|
||||
, authOAuth2
|
||||
, authOAuth2Widget
|
||||
) where
|
||||
@ -74,16 +72,7 @@ import URI.ByteString
|
||||
import URI.ByteString.Extension
|
||||
import Yesod.Auth
|
||||
import Yesod.Auth.OAuth2
|
||||
|
||||
-- | 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
|
||||
import Yesod.Auth.OAuth2.Exception
|
||||
|
||||
-- | Retrieve a user's profile as JSON
|
||||
--
|
||||
|
||||
Loading…
Reference in New Issue
Block a user