Might be good. It looks like the exception processing bits are in flux
at the moment. Not sure where the ultimate destination is but (my own
tuppence, this) I'm not sure we need a generic custom Joomla
exception. We could make an argument, I think, for custom exception
handlers for a specific area, but Joomla itself is too broad for that.
I'd try to use the standard PHP exception as much as possible, and
only branch out into specialization if it became necessary. Makes it
simpler that way.
I'm more fond of exceptions that log things by default, rather than
display them, because then the exception data is always there to be
examined at a later time. Also, broadcasting error information gives
someone whose intentions are, shall we say, less than pure, a teacup
more information about your system than they had before.
On Jun 22, 5:27 pm, Joseph LeBlanc <
cont...@jlleblanc.com> wrote:
> FWIW, I've worked with other frameworks (Kohana, for one) where errors get generated as pages by the framework, regardless of the HTML in your view. Given that, it wouldn't be inconceivable to have the platform generate an HTML error message with two options:
>
> 1) Render a plain error page (similar to the ones in Joomla 1.5)
> 2) Pass the display onto the application for rendering (have the CMS render the page, while using the HTML generated by the platform)
>
> In any event, I've held off on writing any patches for changing things to Exception, since there are places where JException is thrown with specific error codes.
>
> -Joe
>
> On Jun 17, 2011, at 5:53 PM, Andrew Eddie wrote:
>
>
>
>
>
>
>
> > I'm pretty sure Louis had some thought on this (I know we've talked
> > about it but the details escape me). We'd want to head towards just
> > using exceptions, but we also need the mechanism to raise the error
> > page as well (whether that's Platform or CMS, I'm not sure - probably
> > CMS). The Platform, though, should only be throwing exceptions, I
> > should think.
>
> > Regards,
> > Andrew Eddie
> >
http://learn.theartofjoomla.com- training videos for Joomla 1.6 developers
>
> > On 18 June 2011 07:39, Joseph LeBlanc <
cont...@jlleblanc.com> wrote:
> >> Perhaps I'm asking the same question here, but I've also noticed that where JException is used in core, it's usually accompanied by an HTTP error code. Should we then replace "throw new JException" with JError::raiseNotice(), JError::raiseWarning(), and JError::raiseError()? And then use JError::raiseError() for uncaught Exceptions (resulting in a 500 error)?
>
> >> -Joe
>
> >> On Jun 14, 2011, at 8:37 PM, Andrew Eddie wrote:
>
> >>> Actually scratch that, we can handle INI files at the "catch" end. In
> >>> that case, I don't think we need JException anymore.
>
> >>> One thing I just came across, though, is how to handle the different
> >>> error levels in moving away from JError. For example, the 1.6 way is:
>
> >>> JError::raiseNotice (orange message)
> >>> JError::raiseWarning (red message)
> >>> JError::raiseError (all stop!)
>
> >>> Now, do they translate to exception codes, or exception classes (or both)?
>
> >>> Regards,
> >>> Andrew Eddie
> >>>
http://learn.theartofjoomla.com- training videos for Joomla 1.6 developers
>
> >>> On 15 June 2011 09:45, Andrew Eddie <
mambob...@gmail.com> wrote:
> >>>> I've been using Exception myself, but an advantage of using JException
> >>>> is that we could override getMessage and allow for lazy loading of
> >>>> error INI files (and that's another topic - language files for
> >>>> platform strings ...).
>
> >>>> Regards,
> >>>> Andrew Eddie
> >>>>
http://learn.theartofjoomla.com- training videos for Joomla 1.6 developers
>
> >>>> On 14 June 2011 23:36, Joseph LeBlanc <
cont...@jlleblanc.com> wrote:
> >>>>> Since nobody has replied to this, I'm going to assume that JException is intended to be thrown instead of Exception. My assumption is based on the fact that if you throw a plain exception with an error code like this:
>
> >>>>> throw new Exception('Whoops, something happened!', 404);
>
> >>>>> ... Joomla will catch that exception, route it through JError, throw a JException object with the 404, which ultimately results in a 404 error code. Running this through JException instead of Exception at least gives developers a place to look for documentation on the behavior.
>
> >>>>> I'll write some patches to clean it up.
>
> >>>>> -Joe
>
> >>>>> On Jun 10, 2011, at 11:34 AM, Joe LeBlanc wrote:
>
> >>>>>> I'm noticing in the codebase that there are many places where a
> >>>>>> standard PHP Exception is being thrown rather than JException. Also,
> >>>>>> LogException and DatabaseException are extended from Exception rather
> >>>>>> than JException.
>
> >>>>>> Also, if you throw an Exception from a component (or plugin code that
> >>>>>> runs during the component execution), it gets caught and sent through
> >>>>>> JError, which ultimately throws a JException.
>
> >>>>>> Since JException is loaded into memory very early in the bootstrap
> >>>>>> process, is there any reason we should be using Exception anywhere in
> >>>>>> the code?
>
> >>>>>> --
> >>>>>> You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
> >>>>>> To post to this group, send an email to
joomla-dev...@googlegroups.com.
> >>>>>> To unsubscribe from this group, send email to
joomla-dev-frame...@googlegroups.com.
> >>>>>> For more options, visit this group athttp://
groups.google.com/group/joomla-dev-framework?hl=en-GB.
> >>>>> For more options, visit this group athttp://
groups.google.com/group/joomla-dev-framework?hl=en-GB.
> >>> For more options, visit this group athttp://
groups.google.com/group/joomla-dev-framework?hl=en-GB.
> >> For more options, visit this group athttp://
groups.google.com/group/joomla-dev-framework?hl=en-GB.