diff --git a/command-handler/src/util/axios-error-handler.js b/command-handler/src/util/axios-error-handler.js index cda3db3..d1b7a5a 100644 --- a/command-handler/src/util/axios-error-handler.js +++ b/command-handler/src/util/axios-error-handler.js @@ -1,7 +1,8 @@ export default function axiosError(e) { const errorObj = { - data: e.response.data, - status: e.response.status, + data: e.response?.data ?? null, + status: e.response?.status ?? null, + message: e.message, stackTrace: e.stack } diff --git a/command-handler/src/util/hetzner/hetzner-servers.js b/command-handler/src/util/hetzner/hetzner-servers.js index 464eed0..5c0da44 100644 --- a/command-handler/src/util/hetzner/hetzner-servers.js +++ b/command-handler/src/util/hetzner/hetzner-servers.js @@ -228,6 +228,15 @@ export default { const userEmail = formatUser(info.user.profile.email); + if (!data) { + app.client.chat.postEphemeral({ + channel: `${body.channel.id}`, + user: `${body.user.id}`, + text: `Failed to get server data from hetzner` + }); + return []; + } + //list the servers and build the buttons for (const server of data.data.servers) { if (server.labels.owner === userEmail) {