Skip to content

Commit 73a8d0b

Browse files
jsadkfsjd
1 parent 027e5da commit 73a8d0b

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/events/index.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,16 @@ export default new Elysia({
100100
return status(401, { error: "not signed", status: "error" });
101101
}
102102
})
103-
.onError(({ error }) => {
104-
if (!("code" in error) || error.code !== "VALIDATION") {
105-
console.error(error);
103+
.onError(({ error, path }) => {
104+
if ("code" in error && error.code === "VALIDATION") {
105+
const validation = error as Error & { all?: unknown };
106+
console.error(`[events] VALIDATION error on ${path}:`, validation.message);
107+
if (validation.all) {
108+
console.error(`[events] VALIDATION details:`, JSON.stringify(validation.all, null, 2));
109+
}
110+
return;
106111
}
112+
console.error(`[events] error on ${path}:`, error);
107113
})
108114
.post(
109115
"/events",

src/models/event.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,13 @@ export const CommandBody = t.Object({
8989
user_id: t.String(),
9090
});
9191

92-
const viewStateValue = t.Object({
93-
type: t.String(),
94-
value: t.Optional(t.String()),
95-
});
92+
const viewStateValue = t.Object(
93+
{
94+
type: t.String(),
95+
value: t.Optional(t.Union([t.String(), t.Null()])),
96+
},
97+
{ additionalProperties: true }
98+
);
9699

97100
export const ViewSubmissionEvent = t.Object(
98101
{

0 commit comments

Comments
 (0)