bmidget/kohana-formo — Issue #166: Handle __toString() exceptions gracefully
Author: kemo
Created: 2012-01-09 12:14:34+00:00
State: open

PHP returns a fatal error when exception is thrown inside of `__toString()`, so debugging becomes almost impossible.

Instead of returning a fatal error, exception should be caught, returning the exception message instead:

public function __toString()
{
try
{
$this->render();
}
catch (Exception $e)
{
return "Error rendering form/field:".$e->getMessage();
}
}

This affects both `Formo_Form` and `Formo_Field`.