Include the field on which retrieval from database failed when throwing a NotFoundException in a recursive retrieval.

develop
Sven Slootweg 12 years ago
parent 42bdba7ce0
commit 8b437c6a4b

@ -60,7 +60,7 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
else
{
$classname = get_class($this);
throw new NotFoundException("Could not locate {$classname} {$uDataSource} in database.");
throw new NotFoundException("Could not locate {$classname} {$uDataSource} in database.", 0, null, "");
}
}
else
@ -179,7 +179,15 @@ abstract class CPHPDatabaseRecordClass extends CPHPBaseClass
{
if($type == $class_type)
{
$value = new $class_name($original_value);
try
{
$value = new $class_name($original_value);
}
catch (NotFoundException $e)
{
$e->field = $variable_name;
throw $e;
}
$variable_type = CPHP_VARIABLE_SAFE;
$found = true;
}

@ -15,7 +15,6 @@ if($_CPHP !== true) { die(); }
class OwnershipException extends Exception {}
class UserAccessException extends Exception {}
class NotFoundException extends Exception {}
class PrototypeException extends Exception {}
class ConstructorException extends Exception {}
class MissingDataException extends Exception {}
@ -39,5 +38,15 @@ class TemplateException extends Exception
}
}
class NotFoundException extends Exception
{
public function __construct($message, $code = 0, $previous = null, $field = "")
{
$this->field = $field;
parent::__construct($message, $code, $previous);
}
}
class TemplateSyntaxException extends TemplateException {}
class TemplateParsingException extends TemplateException {}

Loading…
Cancel
Save