git.iko.soy/typeable/hjsonschema
on master help sign in
Don't catch asynchronous exceptions.
commit43bf0cd1d8ebb42d18b84460bf6d0ffa86a1675f authorIan Grant Jeffries <ian@housejeffries.com> dateSat 17 Mar 2018, 17:09 (9 years ago) parentaa9f083
2 files changed+5−3
hjsonschema.cabal+1 src/JSONSchema/Fetch.hs+4−3
hjsonschema.cabal+1
@@ -75,6 +75,7 @@ library
7575 , profunctors >= 5.0
7676 , protolude >= 0.1.10
7777 , QuickCheck >= 2.8
78+ , safe-exceptions >= 0.1.6
7879 , scientific >= 0.3
7980 , semigroups >= 0.18
8081 , unordered-containers >= 0.2
src/JSONSchema/Fetch.hs+4−3
@@ -2,7 +2,7 @@ module JSONSchema.Fetch where
22
33import Import
44
5−import Control.Exception (IOException, catch)
5+import qualified Control.Exception.Safe as Safe
66import Control.Monad (foldM)
77import qualified Data.ByteString as BS
88import qualified Data.ByteString.Lazy as LBS
@@ -62,7 +62,7 @@ referencesViaHTTP'
6262referencesViaHTTP' info sw = do
6363 manager <- NC.newManager NCTLS.tlsManagerSettings
6464 let f = referencesMethodAgnostic (getURL manager) info sw
65− catch (first HTTPParseFailure <$> f) handler
65+ Safe.catch (first HTTPParseFailure <$> f) handler
6666 where
6767 getURL :: NC.Manager -> Text -> IO BS.ByteString
6868 getURL man url = do
@@ -88,7 +88,8 @@ referencesViaFilesystem'
8888 => FetchInfo schema
8989 -> SchemaWithURI schema
9090 -> IO (Either FilesystemFailure (URISchemaMap schema))
91−referencesViaFilesystem' info sw = catch (first FSParseFailure <$> f) handler
91+referencesViaFilesystem' info sw =
92+ Safe.catch (first FSParseFailure <$> f) handler
9293 where
9394 f :: IO (Either Text (URISchemaMap schema))
9495 f = referencesMethodAgnostic (BS.readFile . T.unpack) info sw