Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/api/challenges/challenges.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Controller, Post, Param, HttpCode, HttpStatus } from '@nestjs/common';
import { Controller, Post, Param, HttpCode, HttpStatus, BadRequestException } from '@nestjs/common';
import { isUUID } from 'class-validator';
import {
ApiOperation,
ApiParam,
Expand Down Expand Up @@ -42,6 +43,10 @@ export class ChallengesController {
@Param('challengeId') challengeId: string,
@User() user: UserInfo,
): Promise<ResponseDto<string>> {
if (!isUUID(challengeId)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ maintainability]
Consider using a more specific exception class or error message to provide additional context about the validation failure. This can help with debugging and logging.

throw new BadRequestException('Invalid challengeId provided! Uuid expected!');
}

const result = new ResponseDto<string>();

try {
Expand Down