[questions][chore] update error handling

pull/409/head
hpkoh 3 years ago
parent 1dfdb70345
commit ab24cee4b6

@ -79,6 +79,13 @@ export const questionsQuestionEncounterRouter = createProtectedRouter()
}, },
}); });
if (questionToUpdate === null) {
throw new TRPCError({
code: 'BAD_REQUEST',
message: 'Question does not exist',
});
}
if (questionToUpdate!.lastSeenAt < input.seenAt) { if (questionToUpdate!.lastSeenAt < input.seenAt) {
await tx.questionsQuestion.update({ await tx.questionsQuestion.update({
data: { data: {

Loading…
Cancel
Save