@@ -18,7 +18,7 @@ import Prelude.Compat
1818import Control.DeepSeq
1919 (NFData (..))
2020import Control.Exception
21− (SomeException)
21+ (SomeException (..))
2222import Control.Monad.Catch
2323 (Exception)
2424import Data.Bifoldable
@@ -40,7 +40,7 @@ import Data.Text
4040import Data.Text.Encoding
4141 (encodeUtf8)
4242import Data.Typeable
43− (Typeable)
43+ (Typeable, typeOf)
4444import GHC.Generics
4545 (Generic)
4646import Network.HTTP.Media
@@ -76,7 +76,10 @@ instance Eq ServantError where
7676 DecodeFailure t r == DecodeFailure t' r' = t == t' && r == r'
7777 UnsupportedContentType mt r == UnsupportedContentType mt' r' = mt == mt' && r == r'
7878 InvalidContentTypeHeader r == InvalidContentTypeHeader r' = r == r'
79− ConnectionError _ == ConnectionError _ = True
79+ ConnectionError exc == ConnectionError exc' = eqSomeException exc exc'
80+ where
81+ -- returns true, if type of exception is the same
82+ eqSomeException (SomeException a) (SomeException b) = typeOf a == typeOf b
8083
8184 -- prevent wild card blindness
8285 FailureResponse {} == _ = False