diff --git a/adapters/admin/persistence/typeorm/errors/TypeOrmAdminSchemaError.ts b/adapters/admin/persistence/typeorm/errors/TypeOrmAdminSchemaError.ts index 4fba5d04c..e0c3f2aac 100644 --- a/adapters/admin/persistence/typeorm/errors/TypeOrmAdminSchemaError.ts +++ b/adapters/admin/persistence/typeorm/errors/TypeOrmAdminSchemaError.ts @@ -7,7 +7,14 @@ export class TypeOrmAdminSchemaError extends Error { message: string; }, ) { - super(`[TypeOrmAdminSchemaError] ${details.entityName}.${details.fieldName}: ${details.reason} - ${details.message}`); + super(''); this.name = 'TypeOrmAdminSchemaError'; + + // Override the message property to be dynamic + Object.defineProperty(this, 'message', { + get: () => `[TypeOrmAdminSchemaError] ${this.details.entityName}.${this.details.fieldName}: ${this.details.reason} - ${this.details.message}`, + enumerable: true, + configurable: true, + }); } } diff --git a/adapters/admin/persistence/typeorm/schema/TypeOrmAdminSchemaGuards.ts b/adapters/admin/persistence/typeorm/schema/TypeOrmAdminSchemaGuards.ts index e1964d5d7..ce42188ab 100644 --- a/adapters/admin/persistence/typeorm/schema/TypeOrmAdminSchemaGuards.ts +++ b/adapters/admin/persistence/typeorm/schema/TypeOrmAdminSchemaGuards.ts @@ -44,7 +44,7 @@ export function assertOptionalString(entityName: string, fieldName: string, valu if (value === null || value === undefined) { return; } - if (typeof value !== 'string') { + if (typeof value !== 'string' || value.trim().length === 0) { throw new TypeOrmAdminSchemaError({ entityName, fieldName,