title: jwt.decode() stuck instead of returning an error on malformed token
body: <p>On an express nodejs server I try to validate a token with the <a href="https://www.npmjs.com/package/jsonwebtoken" rel="nofollow noreferrer">jsonwebtoken</a> package (v8.5.1). I experience something really odd and don't seem to find a solution for this.</p>
  <p>Whenever I try to verify a malformed token the jwt.verify method becomes stuck instead of throwing the usual error which I expected. Can someone please point out what I am doing wrong. Underneath you'll find the code which becomes completely stuck.</p>
  <p>When the token is valid, the console.log statement returns the content of the jwt. When it is invalid, the console.log statement is never run and the endpoint just never responds. So for some reason, it becomes completely stuck on the jwt.verify method.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>router.post('/session', async (req, res) =&gt; {
    try {
      const token = req.headers['x-auth-token'];
      if (!token) {
        return res.json(false);
      }
  
      const verified = jwt.verify(token, process.env.JWT_SECRET);
      console.log(verified);
      if (!verified) {
        return res.json(false);
      }
      return res.json(true);
    } catch (e) {
      return res.status(500);
    }
  });</code></pre>
  </div>
  </div>
  </p>