Skip to content

Commit

Permalink
Merge pull request #45 from GlueOps/fix/axios-error
Browse files Browse the repository at this point in the history
fix: axios error e.response undefined
  • Loading branch information
NichArchA82 authored Oct 10, 2024
2 parents db5e954 + 559bbac commit 632a313
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions command-handler/src/util/axios-error-handler.js
Original file line number Diff line number Diff line change
@@ -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

}
Expand Down
9 changes: 9 additions & 0 deletions command-handler/src/util/hetzner/hetzner-servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 632a313

Please sign in to comment.