Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug hivemind slash command #221

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/commands/info/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default {
});
logger.info({ interaction_id: interaction.id, user: interaction.user }, 'question command ended');
} catch (error) {
logger.error(error, 'is failed');
logger.error(error, 'question command is failed');
logger.error({ interaction_id: interaction.id, user: interaction.user }, 'question command is failed');
await interactionService.createInteractionResponse(interaction, {
type: 4,
data: {
Expand Down
29 changes: 24 additions & 5 deletions src/services/interaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ async function createInteractionResponse(
},
);
if (!response.ok) {
throw new Error();
const errorResponse = await response.text();
throw new Error(errorResponse);
}
} catch (error) {
logger.error(error, 'Failed to send interaction response');
logger.error({ interaction_id: interaction.id, user: interaction.user }, 'Failed to send interaction response');
}
}

Expand Down Expand Up @@ -74,10 +76,15 @@ async function getOriginalInteractionResponse(interaction: ChatInputCommandInter
if (response.ok) {
return await response.json();
} else {
throw new Error(await response.json());
const errorResponse = await response.text();
throw new Error(errorResponse);
}
} catch (error) {
logger.error(error, 'Failed to get original interaction response');
logger.error(
{ interaction_id: interaction.id, user: interaction.user },
'Failed to get original interaction response',
);
}
}

Expand Down Expand Up @@ -112,10 +119,15 @@ async function editOriginalInteractionResponse(
if (response.ok) {
return await response.json();
} else {
throw new Error(await response.json());
const errorResponse = await response.text();
throw new Error(errorResponse);
}
} catch (error) {
logger.error(error, 'Failed to edit original interaction response');
logger.error(
{ interaction_id: interaction.id, user: interaction.user },
'Failed to edit original interaction response',
);
}
}

Expand Down Expand Up @@ -144,10 +156,15 @@ async function deleteOriginalInteractionResponse(interaction: ChatInputCommandIn
},
);
if (!response.ok) {
throw new Error(await response.json());
const errorResponse = await response.text();
throw new Error(errorResponse);
}
} catch (error) {
logger.error(error, 'Failed to delete original interaction response');
logger.error(
{ interaction_id: interaction.id, user: interaction.user },
'Failed to delete original interaction response',
);
}
}

Expand Down Expand Up @@ -176,10 +193,12 @@ async function createFollowUpMessage(interaction: ChatInputCommandInteraction_br
if (response.ok) {
return await response.json();
} else {
throw new Error(await response.json());
const errorResponse = await response.text();
throw new Error(errorResponse);
}
} catch (error) {
logger.error(error, 'Failed to create follow up message');
logger.error({ interaction_id: interaction.id, user: interaction.user }, 'Failed to create follow up message');
}
}

Expand Down
Loading