Skip to content

Commit b1a99f8

Browse files
committed
Fix statSync exceptions being uncatchable
1 parent ce7a8eb commit b1a99f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Node/FS/Sync.purs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ chmod file perms = mkEff $ \_ -> runFn2
113113
stat :: forall eff. FilePath
114114
-> Eff (fs :: FS, err :: EXCEPTION | eff) Stats
115115

116-
stat file = return $ Stats $ runFn1
116+
stat file = map Stats $ mkEff $ \_ -> runFn1
117117
fs.statSync file
118118

119119
-- | Creates a link to an existing file.
@@ -257,7 +257,7 @@ appendTextFile encoding file buff = mkEff $ \_ -> runFn3
257257
-- | Check if the path exists.
258258
exists :: forall eff. FilePath
259259
-> Eff (fs :: FS | eff) Boolean
260-
exists file = return $ fs.existsSync file
260+
exists file = mkEff $ \_ -> fs.existsSync file
261261

262262
-- | Open a file synchronously. See the [Node documentation](http://nodejs.org/api/fs.html#fs_fs_opensync_path_flags_mode)
263263
-- | for details.

0 commit comments

Comments
 (0)