<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>HPath.IO.Errors</title><linkhref="ocean.css"rel="stylesheet"type="text/css"title="Ocean"/><scriptsrc="haddock-util.js"type="text/javascript"></script><scriptsrc="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"type="text/javascript"></script><scripttype="text/javascript">//<![CDATA[
This follows symbolic links.</p></div></div><divclass="top"><pclass="src"><aid="v:throwDestinationInSource"class="def">throwDestinationInSource</a><ahref="src/HPath-IO-Errors.html#throwDestinationInSource"class="link">Source</a><ahref="#v:throwDestinationInSource"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>source dir</p></td></tr><tr><tdclass="src">-><ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a></td><tdclass="doc"><p>full destination, <code>dirname dest</code>
must exist</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> ()</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Checks whether the destination directory is contained
of the destination.</p></div></div><divclass="top"><pclass="src"><aid="v:doesFileExist"class="def">doesFileExist</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HPath-IO-Errors.html#doesFileExist"class="link">Source</a><ahref="#v:doesFileExist"class="selflink">#</a></p><divclass="doc"><p>Checks if the given file exists and is not a directory.
Does not follow symlinks.</p></div></div><divclass="top"><pclass="src"><aid="v:doesDirectoryExist"class="def">doesDirectoryExist</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HPath-IO-Errors.html#doesDirectoryExist"class="link">Source</a><ahref="#v:doesDirectoryExist"class="selflink">#</a></p><divclass="doc"><p>Checks if the given file exists and is a directory.
Does not follow symlinks.</p></div></div><divclass="top"><pclass="src"><aid="v:isWritable"class="def">isWritable</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HPath-IO-Errors.html#isWritable"class="link">Source</a><ahref="#v:isWritable"class="selflink">#</a></p><divclass="doc"><p>Checks whether a file or folder is writable.</p></div></div><divclass="top"><pclass="src"><aid="v:canOpenDirectory"class="def">canOpenDirectory</a> :: <ahref="HPath.html#t:Path">Path</a><ahref="HPath.html#t:Abs">Abs</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Data-Bool.html#t:Bool">Bool</a><ahref="src/HPath-IO-Errors.html#canOpenDirectory"class="link">Source</a><ahref="#v:canOpenDirectory"class="selflink">#</a></p><divclass="doc"><p>Checks whether the directory at the given path exists and can be
opened. This invokes <code>openDirStream</code> which follows symlinks.</p></div></div><h1id="g:4">Error handling functions</h1><divclass="top"><pclass="src"><aid="v:catchErrno"class="def">catchErrno</a><ahref="src/HPath-IO-Errors.html#catchErrno"class="link">Source</a><ahref="#v:catchErrno"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: [<ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Foreign-C-Error.html#t:Errno">Errno</a>]</td><tdclass="doc"><p>errno to catch</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc"><p>action to try, which can raise an IOException</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc"><p>action to carry out in case of an IOException and
if errno matches</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Carries out an action, then checks if there is an IOException and
it rethrows the error.</p></div></div><divclass="top"><pclass="src"><aid="v:rethrowErrnoAs"class="def">rethrowErrnoAs</a><ahref="src/HPath-IO-Errors.html#rethrowErrnoAs"class="link">Source</a><ahref="#v:rethrowErrnoAs"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Exception-Base.html#t:Exception">Exception</a> e</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">=> [<ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Foreign-C-Error.html#t:Errno">Errno</a>]</td><tdclass="doc"><p>errno to catch</p></td></tr><tr><tdclass="src">-> e</td><tdclass="doc"><p>rethrow as if errno matches</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc"><p>action to try</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Execute the given action and retrow IO exceptions as a new Exception
as is.</p></div></div><divclass="top"><pclass="src"><aid="v:handleIOError"class="def">handleIOError</a> :: (<ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO-Error.html#t:IOError">IOError</a> -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a) -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a <ahref="src/HPath-IO-Errors.html#handleIOError"class="link">Source</a><ahref="#v:handleIOError"class="selflink">#</a></p><divclass="doc"><p>Like <code><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO-Error.html#v:catchIOError">catchIOError</a></code>, with arguments swapped.</p></div></div><divclass="top"><pclass="src"><aid="v:bracketeer"class="def">bracketeer</a><ahref="src/HPath-IO-Errors.html#bracketeer"class="link">Source</a><ahref="#v:bracketeer"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc"><p>computation to run first</p></td></tr><tr><tdclass="src">-> (a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> b)</td><tdclass="doc"><p>computation to run last, when
no exception was raised</p></td></tr><tr><tdclass="src">-> (a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> b)</td><tdclass="doc"><p>computation to run last,
when an exception was raised</p></td></tr><tr><tdclass="src">-> (a -><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> c)</td><tdclass="doc"><p>computation to run in-between</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> c</td><tdclass="doc empty"> </td></tr></table></div><divclass="doc"><p>Like <code><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Exception-Base.html#v:bracket">bracket</a></code>, but allows to have different clean-up
has raised an exception or not. </p></div></div><divclass="top"><pclass="src"><aid="v:reactOnError"class="def">reactOnError</a><ahref="src/HPath-IO-Errors.html#reactOnError"class="link">Source</a><ahref="#v:reactOnError"class="selflink">#</a></p><divclass="subs arguments"><pclass="caption">Arguments</p><table><tr><tdclass="src">:: <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc empty"> </td></tr><tr><tdclass="src">-> [(<ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO-Error.html#t:IOErrorType">IOErrorType</a>, <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a)]</td><tdclass="doc"><p>reaction on IO errors</p></td></tr><tr><tdclass="src">-> [(<ahref="HPath-IO-Errors.html#t:HPathIOException">HPathIOException</a>, <ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a)]</td><tdclass="doc"><p>reaction on HPathIOException</p></td></tr><tr><tdclass="src">-><ahref="https://hackage.haskell.org/package/base-4.9.0.0/docs/System-IO.html#t:IO">IO</a> a</td><tdclass="doc empty"> </td></tr></table></div></div></div></div><divid="footer"><p>Produced by <ahref="http://www.haskell.org/haddock/">Haddock</a> version 2.17.2</p></div></body></html>