Commit 77456421 authored by catch's avatar catch

Issue #1231710 by Hydra, dcam, kathyh, klausi, mlncn: Field exceptions should...

Issue #1231710 by Hydra, dcam, kathyh, klausi, mlncn: Field exceptions should return the name of the field that has exceptions.
parent 0ae4c3c3
......@@ -225,13 +225,13 @@ public function __construct(array $values, $entity_type = 'field_entity') {
throw new FieldException('Attempt to create an unnamed field.');
}
if (!preg_match('/^[_a-z]+[_a-z0-9]*$/', $values['name'])) {
throw new FieldException('Attempt to create a field with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character');
throw new FieldException(format_string('Attempt to create a field @field_name with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character', array('@field_name' => $values['name'])));
}
if (empty($values['type'])) {
throw new FieldException('Attempt to create a field with no type.');
throw new FieldException(format_string('Attempt to create field @field_name with no type.', array('@field_name' => $values['name'])));
}
if (empty($values['entity_type'])) {
throw new FieldException('Attempt to create a field with no entity_type.');
throw new FieldException(format_string('Attempt to create a field @field_name with no entity_type.', array('@field_name' => $values['name'])));
}
parent::__construct($values, $entity_type);
......@@ -451,7 +451,7 @@ public function getSchema() {
// Check that the schema does not include forbidden column names.
if (array_intersect(array_keys($schema['columns']), static::getReservedColumns())) {
throw new FieldException('Illegal field type columns.');
throw new FieldException(format_string('Illegal field type @field_type on @field_name.', array('@field_type' => $this->type, '@field_name' => $this->name)));
}
// Merge custom indexes with those specified by the field type. Custom
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment