avoid 500 if method is not defined
This commit is contained in:
parent
79dca2fe6b
commit
2ec659baac
|
@ -20,7 +20,7 @@ if ($method) {
|
||||||
echo $viewer->{$method}();
|
echo $viewer->{$method}();
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
echo json_encode(['error' => $e->msg()]);
|
echo json_encode(['error' => $e->getMessage()]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class View extends \HTML
|
||||||
*
|
*
|
||||||
* @return string HTML code for Form.
|
* @return string HTML code for Form.
|
||||||
*
|
*
|
||||||
* @throws Exception On error.
|
* @throws \Exception On error.
|
||||||
*/
|
*/
|
||||||
public function loadForm()
|
public function loadForm()
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,11 @@ class View extends \HTML
|
||||||
$itemClass = VisualConsole::getItemClass($type);
|
$itemClass = VisualConsole::getItemClass($type);
|
||||||
|
|
||||||
if (!isset($itemClass)) {
|
if (!isset($itemClass)) {
|
||||||
throw new Exception(__('Item type not valid ['.$type.']'));
|
throw new \Exception(__('Item type not valid ['.$type.']'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (\method_exists($itemClass, 'getFormInputs') === false) {
|
||||||
|
throw new \Exception(__('Item type has no getFormInputs method ['.$type.']'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$form = [
|
$form = [
|
||||||
|
|
Loading…
Reference in New Issue