title: How can I get rid of duplicated catch() methods?
body: <p>My current codes are as below.</p>
  <p>However, I want to make a shared function/module to remove catch() methods.</p>
  <p>Is there any way to handle the repeated catch()?</p>
  <pre><code>import { Token, Post } from &quot;../../entities&quot;;
  import { getRepository } from &quot;typeorm&quot;;
  
  const saveRefreshToken = async (token: Token) =&gt;
      await getRepository(Token)
          .save(token)
          .then((savedToken) =&gt; savedToken)
          .catch(() =&gt; createInternalServerError()); // repeated catch() method
  
  const savePost = async (post: Post) =&gt;
      await getRepository(Post)
          .save(post)
          .then((post) =&gt; post)
          .catch(() =&gt; createInternalServerError()); // repeated catch() method
  
  const deleteRefreshToken = async (req: Request): Promise&lt;unknown&gt; =&gt; {
      const user = req.user as User;
      return await getRepository(Token)
          .delete({ user })
          .then(() =&gt; null)
          .catch(() =&gt; createInternalServerError()); // repeated catch() method
  };
  
  </code></pre>