@@ -18,7 +18,7 @@ import Prelude.Compat
18import Control.DeepSeq
18import Control.DeepSeq
19 (NFData (..))
19 (NFData (..))
20import Control.Exception
20import Control.Exception
21− (SomeException)
21+ (SomeException (..))
22import Control.Monad.Catch
22import Control.Monad.Catch
23 (Exception)
23 (Exception)
24import Data.Bifoldable
24import Data.Bifoldable
@@ -40,7 +40,7 @@ import Data.Text
40import Data.Text.Encoding
40import Data.Text.Encoding
41 (encodeUtf8)
41 (encodeUtf8)
42import Data.Typeable
42import Data.Typeable
43− (Typeable)
43+ (Typeable, typeOf)
44import GHC.Generics
44import GHC.Generics
46import Network.HTTP.Media
46import Network.HTTP.Media
@@ -76,7 +76,10 @@ instance Eq ServantError where
76 DecodeFailure t r == DecodeFailure t' r' = t == t' && r == r'
76 DecodeFailure t r == DecodeFailure t' r' = t == t' && r == r'
77 UnsupportedContentType mt r == UnsupportedContentType mt' r' = mt == mt' && r == r'
77 UnsupportedContentType mt r == UnsupportedContentType mt' r' = mt == mt' && r == r'
78 InvalidContentTypeHeader r == InvalidContentTypeHeader r' = r == r'
78 InvalidContentTypeHeader r == InvalidContentTypeHeader r' = r == r'
79− ConnectionError _ == ConnectionError _ = True
79+ ConnectionError exc == ConnectionError exc' = eqSomeException exc exc'
81+ -- returns true, if type of exception is the same
82+ eqSomeException (SomeException a) (SomeException b) = typeOf a == typeOf b
81 -- prevent wild card blindness
84 -- prevent wild card blindness
82 FailureResponse {} == _ = False
85 FailureResponse {} == _ = False