Complete the code to throw a structured error with a message.
throw new HttpException({ message: [1] }, HttpStatus.BAD_REQUEST);The error message must be a string inside quotes to be valid JSON in the error body.
Complete the code to create a structured error with a custom error code.
throw new HttpException({ message: 'Not found', code: [1] }, HttpStatus.NOT_FOUND);The error code should be a string inside quotes to be part of the structured error object.
Fix the error in the code to properly return a structured error response.
return response.status(HttpStatus.BAD_REQUEST).json({ error: [1] });
The error field should be an object with a message property for structured errors.
Fill both blanks to create a structured error with message and details.
throw new HttpException({ message: [1], details: [2] }, HttpStatus.CONFLICT);The message is a string describing the error, and details is an object with extra info.
Fill all three blanks to create a structured error with message, code, and timestamp.
throw new HttpException({ message: [1], code: [2], timestamp: [3] }, HttpStatus.INTERNAL_SERVER_ERROR);The message and code are strings, and timestamp is an ISO string from the current date.