title: How to catch and save all errors in strapi?
body: <p>I'm trying to integrate my strapi application with sentry, for which I will need to write a middleware. Use the following documentation: <a href="https://strapi.io/documentation/3.0.0-beta.x/advanced/middlewares.html" rel="nofollow noreferrer">https://strapi.io/documentation/3.0.0-beta.x/advanced/middlewares.html</a> I was able to create a custom middleware with the following:</p>
  
  <pre class="lang-js prettyprint-override"><code>module.exports = strapi =&gt; {
    return {
      initialize() {
        strapi.app.use(async (ctx, next) =&gt; {
          try {
            await next();
          } catch (error) {
            Sentry.captureException(error)
          }
  
        });
      }
    };
  };
  
  </code></pre>
  
  <p>However, doing so is preventing strapi to print out the errors to console the usual way but the error is captured by sentry application. </p>
  
  <p><strong>So, my question is</strong>: How do I capture the error "seamlessly" and send it to a third party application, at the same time not hinder with the default functioning and error logging of the strapi to console.</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>Thanks :)</p>
  
  <p><strong>EDIT:</strong> I figured out that all strapi errors are accessible at the "boom" middleware as pointed out in this file: <a href="https://github.com/strapi/strapi/blob/6309af25c921640cb76aeeda463e55db1eb53ef1/packages/strapi/lib/middlewares/boom/index.js#L69" rel="nofollow noreferrer">https://github.com/strapi/strapi/blob/6309af25c921640cb76aeeda463e55db1eb53ef1/packages/strapi/lib/middlewares/boom/index.js#L69</a></p>