chore: improve monitoring for fix: handle string-typed options in transformEnumV

**`resolver-validation.pipe.ts`**: Wrapped the `plainToInstance` call in a try-catch that converts any `@Transform` decorator errors into `UserInputError` GraphQL responses. Previously, if a `@Transform` function threw (e.g., `TypeError: options?.map is not a function`), the error propagated as an unhandled exception captured by Sentry. Now, these malformed-input errors are returned to the client as proper GraphQL `UserInputError` responses with a descriptive message, reducing Sentry noise from client-side input issues.

This follows the existing pattern in the same file where `safeClassValidatorValidateWrapper` already catches validation errors, and the pipe already throws `UserInputError` for invalid inputs.
This commit is contained in:
Sonarly Claude Code
2026-03-19 15:13:33 +00:00
parent eac6723d78
commit e7f4a4cce8
@@ -29,7 +29,16 @@ export class ResolverValidationPipe implements PipeTransform {
return value;
}
const object = plainToInstance(metatype, value);
let object: object;
try {
object = plainToInstance(metatype, value);
} catch (error) {
throw new UserInputError(
`Invalid input: ${error instanceof Error ? error.message : 'transformation failed'}`,
);
}
const errors = await safeClassValidatorValidateWrapper(object);
if (errors.length === 0) {