{-# LANGUAGE DeriveDataTypeable #-}

module Yesod.Auth.OAuth2.Exception
  ( YesodOAuth2Exception (..)
  ) where

import Control.Exception.Safe
import Data.ByteString.Lazy (ByteString)
import Data.Text (Text)

data YesodOAuth2Exception
  = -- | HTTP error during OAuth2 handshake
    --
    -- Plugin name and JSON-encoded @OAuth2Error@ from @hoauth2@.
    OAuth2Error Text ByteString
  | -- | User profile was not as expected
    --
    -- Plugin name and Aeson parse error message.
    JSONDecodingError Text String
  | -- | Other error conditions
    --
    -- Plugin name and error message.
    GenericError Text String
  deriving (Int -> YesodOAuth2Exception -> ShowS
[YesodOAuth2Exception] -> ShowS
YesodOAuth2Exception -> String
(Int -> YesodOAuth2Exception -> ShowS)
-> (YesodOAuth2Exception -> String)
-> ([YesodOAuth2Exception] -> ShowS)
-> Show YesodOAuth2Exception
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> YesodOAuth2Exception -> ShowS
showsPrec :: Int -> YesodOAuth2Exception -> ShowS
$cshow :: YesodOAuth2Exception -> String
show :: YesodOAuth2Exception -> String
$cshowList :: [YesodOAuth2Exception] -> ShowS
showList :: [YesodOAuth2Exception] -> ShowS
Show, Typeable)

instance Exception YesodOAuth2Exception