JObject::setError optionally take an exception?

53 views
Skip to first unread message

Andrew Eddie

unread,
Jan 27, 2009, 10:51:22 PM1/27/09
to joomla-dev...@googlegroups.com
For 1.6

Would is make sense for JObject::setError to be able to take an
exception so that we can do things like:

catch (JException $e) {
$this->setError($e);
return false;
}

In fact, if it returned false then we could trim that to:

catch (JException $e) {
return $this->setError($e);
}

Thoughts?

Regards,
Andrew Eddie

Sam Moffatt

unread,
Jan 27, 2009, 10:56:15 PM1/27/09
to joomla-dev...@googlegroups.com
How would getError work in that case? Should it return the exception
or the string?

Sam Moffatt
http://pasamio.id.au

Andrew Eddie

unread,
Jan 27, 2009, 10:58:41 PM1/27/09
to joomla-dev...@googlegroups.com
The string.

So in setError you'd do:

if ($error instance of Exception) {
$error = $error->getMessage();
}
array_push($this->_errors, $error);
return false;


Regards,
Andrew Eddie



2009/1/28 Sam Moffatt <pas...@gmail.com>:

Louis Landry

unread,
Jan 27, 2009, 10:59:30 PM1/27/09
to joomla-dev...@googlegroups.com
I can get behind that.  an Exception is certainly an error :)

- Louis
--
Development Coordinator
Joomla! ... because open source matters.
http://www.joomla.org
Reply all
Reply to author
Forward
0 new messages