title: how to catch an exception thrown by httpLbs (http-client)
body: <p>I have a yesod application that uses http-client <a href="https://www.stackage.org/haddock/lts-9.0/http-client-0.5.7.0/Network-HTTP-Client.html#v:httpLbs" rel="nofollow noreferrer">https://www.stackage.org/haddock/lts-9.0/http-client-0.5.7.0/Network-HTTP-Client.html#v:httpLbs</a> . I am calling</p>
  
  <pre><code>resp &lt;- httpLbs req man
  </code></pre>
  
  <p>inside the <code>Handler (Response BSL.ByteString)</code>  monad.</p>
  
  <p>I am getting this (in the application's log)</p>
  
  <pre><code>6/Aug/2017:15:14:17 +0200 [Error#yesod-core] HttpExceptionRequest Request { ...
  </code></pre>
  
  <p>(the next line of code never gets executed)</p>
  
  <p>Instead, I want to catch the exception, and handle it in my code. How?</p>