switch statement not triggering in catch function

Hi,

I'm trying to handle errors when trying to fetch a message but it just doesn't run the switch statement.

Does someone have an idea why?

const msg = await channel.messages.fetch(serverConfig.ticketMessage.id).catch(e => {
  console.log("Error", e.status);  // gets logged
  switch (e.status) {
    case 404:
      interaction.reply({ content: `The message could not be edited. It may have been deleted.` });  // does not get logged
      return;
    case 403:
      interaction.reply({ content: `The message could not be edited. I don't have access to the channel.` });  // does not get logged
      return;
    default:
      console.log("Test");  // does not get logged
      break;
  }
  console.log("Test 2");  // does not get logged
});
Was this page helpful?