Skip to content

Commit 6df7875

Browse files
committed
Better error handling when adding INCS
1 parent 1df12e2 commit 6df7875

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/server.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ app.options(/category_select-.*/, async ({ options, ack }) => {
130130
});
131131

132132
// Listen for the interaction from the dropdown menu
133-
app.action(/category_select-.*/, async ({ body, ack, say }) => {
133+
app.action(/category_select-.*/, async ({ body, ack, respond }) => {
134134
// Acknowledge the action
135135
await ack();
136136
console.log("body", body);
@@ -141,11 +141,16 @@ app.action(/category_select-.*/, async ({ body, ack, say }) => {
141141
const selectedCategory = body.actions[0].selected_option.text.text;
142142
const dropdown_id = body.actions[0].action_id;
143143
try {
144-
addOrUpdateInc(body.user.username, text, selectedCategory, dropdown_id);
145-
await say(`You selected: ${selectedCategory}`);
144+
// Add or update the incident
145+
await addOrUpdateInc(body.user.username, text, selectedCategory, dropdown_id);
146+
await respond({
147+
text: `✅ You selected: ${selectedCategory}`, // Message with checkmark
148+
});
146149
} catch (error) {
147-
say("There was an error adding the incident. Please try again later.");
148-
console.error("Error adding incident:", error);
150+
await respond({
151+
text: "❌ There was an error adding the incident. Please try again later.",
152+
});
153+
console.error("Error adding incident:", error);
149154
}
150155

151156
});

0 commit comments

Comments
 (0)