In GsoC multilingual Project we are trying to check if the item table exist.
So we use $model->getTable()
and catch the exception throwed when the table doesn't exist.
That exception in throwed by JModelLegacy here: https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/model/legacy.php#L472
The problem is: besides this exception (that we can catch with try/catch) we get a warning message that comes from JTable::getInstance (here https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/table/table.php#L294).
So there is something strange here ... one exception + one warning ?
You can see that warning if, for instance you add to isis template index.php
$table = JTable::getInstance('bla', 'Table', array('dbo' => JFactory::getDbo()));
Get an exception that we can catch.
We get an exception and a warning instead of only an exception.
Latest staging
@mbabker i ask for your help on this. Do you think that warning can be removed or replaced for an exception with B/C?
ok will do a PR for that
thanks
Category | ⇒ | Libraries |
Some have argued converting an API from returning boolean values to throwing Exceptions is a B/C break. To me that'd be the best option though for this issue. In lieu of that, having it not raise a warning and just return the boolean value would be the next best option with it clearly documented in code that as of 4.0 an Exception will be thrown (type to be determined).