Log invalid uuids (#15099)

I had an issue with invalid UUIDs, and I think it would be easier to
find the offending one if the UUID were included in the error message.

This way a database dump can be easily searched.

---------

Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
RaphiTobi
2025-10-17 14:33:33 +02:00
committed by GitHub
co-authored by prastoin
parent c554a6afbc
commit 9cd957844e
3 changed files with 6 additions and 3 deletions
@@ -9,7 +9,9 @@ const checkUUID = (value: any): string => {
throw new ValidationError('UUID must be a string');
}
if (!uuidValidate(value)) {
throw new ValidationError('Invalid UUID');
throw new ValidationError(`Invalid UUID`, {
value,
});
}
return value;
@@ -122,8 +122,8 @@ export class SyntaxError extends BaseGraphQLError {
}
export class ValidationError extends BaseGraphQLError {
constructor(message: string) {
super(message, ErrorCode.GRAPHQL_VALIDATION_FAILED);
constructor(message: string, extensions?: BaseGraphQLError['extensions']) {
super(message, ErrorCode.GRAPHQL_VALIDATION_FAILED, extensions);
Object.defineProperty(this, 'name', { value: 'ValidationError' });
}
@@ -164,6 +164,7 @@ exports[`Object metadata update should fail when labelIdentifier is not a uuid 1
"status": 400,
},
"userFriendlyMessage": "An error occurred.",
"value": "not-a-uuid",
},
"message": "Invalid UUID",
"name": "ValidationError",