Use try/catch to handle errors

Actions might fail silently if you don't explicitly handle errors.

Catch errors by using try/catch in your hook code.


This example tries to download from a non-existent website:

module.exports = async function (payload, actions) {
  try {
    const { data } = await actions.http.get('https://no-such-website.dev');
  } catch (err) {
    console.error('Error occured: ', err)
  }
}

Here is the result of the test run: