From a23ae00818b86dea6a5206dfa432e4e35ff6ade1 Mon Sep 17 00:00:00 2001 From: highfalutin Date: Tue, 13 Apr 2021 22:59:41 -0700 Subject: [PATCH] Make error text more helpful and spelt correckly Provide a bit more context when possible. --- CRM/Core/CodeGen/Specification.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index 0cf1843286..e8e7160cab 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -532,7 +532,7 @@ class CRM_Core_CodeGen_Specification { // all fieldnames have to be defined and should exist in schema. foreach ($primaryKey['field'] as $fieldName) { if (!$fieldName) { - echo "Invalid field defination for index $name\n"; + echo "Invalid field definition for index '$name' in table ${table['name']}\n"; return; } $parenOffset = strpos($fieldName, '('); @@ -540,7 +540,7 @@ class CRM_Core_CodeGen_Specification { $fieldName = substr($fieldName, 0, $parenOffset); } if (!array_key_exists($fieldName, $fields)) { - echo "Table does not contain $fieldName\n"; + echo "Missing definition of field '$fieldName' for index '$name' in table ${table['name']}\n"; print_r($fields); exit(); } @@ -596,7 +596,7 @@ class CRM_Core_CodeGen_Specification { // all fieldnames have to be defined and should exist in schema. foreach ($index['field'] as $fieldName) { if (!$fieldName) { - echo "Invalid field defination for index $indexName\n"; + echo "Invalid field definition for index '$indexName'\n"; return; } $parenOffset = strpos($fieldName, '('); @@ -604,7 +604,7 @@ class CRM_Core_CodeGen_Specification { $fieldName = substr($fieldName, 0, $parenOffset); } if (!array_key_exists($fieldName, $fields)) { - echo "Table does not contain $fieldName\n"; + echo "Missing definition of field '$fieldName' for index '$indexName'. Fields defined:\n"; print_r($fields); exit(); } @@ -623,7 +623,7 @@ class CRM_Core_CodeGen_Specification { /** need to make sure there is a field of type name */ if (!array_key_exists($name, $fields)) { - echo "foreign $name in $currentTableName does not have a field definition, ignoring\n"; + echo "Foreign key '$name' in $currentTableName does not have a field definition, ignoring\n"; return; } -- 2.25.1