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:
+3
-1
@@ -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' });
|
||||
}
|
||||
|
||||
+1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user