The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Log invalid uuids (#15099)
RaphiTobi9cd957844e74
diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars/uuid.scalar.ts b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars/uuid.scalar.tsindex acec37607f6..6a2513b8971 100644--- a/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars/uuid.scalar.ts+++ b/packages/twenty-server/src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars/uuid.scalar.ts@@ -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;diff --git a/packages/twenty-server/src/engine/core-modules/graphql/utils/graphql-errors.util.ts b/packages/twenty-server/src/engine/core-modules/graphql/utils/graphql-errors.util.tsindex e59d61f79f6..f108abee9eb 100644--- a/packages/twenty-server/src/engine/core-modules/graphql/utils/graphql-errors.util.ts+++ b/packages/twenty-server/src/engine/core-modules/graphql/utils/graphql-errors.util.ts@@ -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' });}diff --git a/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-update-one-object-metadata.integration-spec.ts.snap b/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-update-one-object-metadata.integration-spec.ts.snapindex 178f1f8eeee..140c563ef03 100644--- a/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-update-one-object-metadata.integration-spec.ts.snap+++ b/packages/twenty-server/test/integration/metadata/suites/object-metadata/__snapshots__/failing-update-one-object-metadata.integration-spec.ts.snap@@ -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",