🔊 More detail question type validation

This commit is contained in:
2025-08-06 00:56:20 +08:00
parent 1a93cdad46
commit 4a36557714

View File

@@ -95,7 +95,7 @@ public class PollService(AppDatabase db, ICacheService cache)
answer[questionId].ValueKind != JsonValueKind.False: answer[questionId].ValueKind != JsonValueKind.False:
throw new Exception($"Answer for question {question.Title} expected to be a boolean"); throw new Exception($"Answer for question {question.Title} expected to be a boolean");
default: default:
throw new ArgumentOutOfRangeException("Question type is not supported: " + question.Type); throw new ArgumentOutOfRangeException($"Question type is not supported: {question.Type} {answer[questionId].ValueKind}");
} }
} }
} }
@@ -312,4 +312,4 @@ public class PollService(AppDatabase db, ICacheService cache)
pollWithStats.UserAnswer = await GetPollAnswer(poll.Id, accountId.Value); pollWithStats.UserAnswer = await GetPollAnswer(poll.Id, accountId.Value);
return new PollEmbed { Id = poll.Id, Poll = pollWithStats }; return new PollEmbed { Id = poll.Id, Poll = pollWithStats };
} }
} }