fix(api): harden notification assignee persistence
This commit is contained in:
@@ -82,6 +82,24 @@ describe("notification procedure support", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("rewrites assignee foreign-key errors to a not found TRPC error", () => {
|
||||
const error = {
|
||||
code: "P2003",
|
||||
meta: { field_name: "Notification_assigneeId_fkey" },
|
||||
};
|
||||
|
||||
try {
|
||||
rethrowNotificationReferenceError(error);
|
||||
throw new Error("expected notification reference error");
|
||||
} catch (caught) {
|
||||
expect(caught).toBeInstanceOf(TRPCError);
|
||||
expect(caught).toMatchObject<Partial<TRPCError>>({
|
||||
code: "NOT_FOUND",
|
||||
message: "Assignee user not found",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("rewrites broadcast source foreign-key errors to a not found TRPC error", () => {
|
||||
const error = {
|
||||
code: "P2003",
|
||||
|
||||
Reference in New Issue
Block a user