title: Best way to catch an error in Models? (Node.js + Sequelize)
body: <p>Is there a simple way to catch an error in an API (server) that's using Node.js and Sequelize (Models)? Here is my code (it uses async + await):</p>
  <pre><code>const router = express.Router()
  const { Operations } = require('../models')
  
  router.post('/operations/add', async (req, res) =&gt; {
      const operations = req.body
      await operations.create(operations)
      res.json(operations)
      console.log('op added!')
  })
  
  router.put('/operations/update/:id', async (req, res) =&gt; {
      const operationId = req.params.id
      const operationUpdatedData = req.body
      const operationById = await Operation.findOne({ where: { id: operationId } })
      const operationUpdated = await operationById.update(operationUpdatedData)
      res.json(operationUpdated)
      console.log('op updated!')
  })
  
  router.delete('/operations/delete/:id', async (req, res) =&gt; {
      const operationId = req.params.id
      await Operations.destroy({ where: { id: operationId } })
      res.send('op deleted!')
      console.log('op deleted!')
  })
  
  module.exports = router
  </code></pre>
  <p>This is how I handle an error in the client:</p>
  <pre><code>axios.post(`http://localhost:9000/operations/add`, data)
              .then(res =&gt; console.log(`op added! (${res.status})`))
              .catch(err =&gt; console.log(`wrong! (${err.response.status} )`))
  </code></pre>
  <p>I don't want anything fancy, but feel free to try whatever you want!</p>