API - Error Management in Joomla 1.5
- louis.landry
- Joomla! Ace
- Posts: 1380
- Joined: Wed Aug 17, 2005 11:03 pm
- Location: San Jose, California
- Contact:
API - Error Management in Joomla 1.5
Hello all,
I thought I would quickly go over one of the changes in the upcoming 1.5 release. Though it was not part of the original roadmap for 1.5, the team determined that it would be beneficial to have a common error manager in Joomla. This would provide a common interface for both the core and 3rd party developers to handle errors. After some research was done, the decision was made to wrap the existing patError class that is packaged with patTemplate. This system provides a whole host of functionality and remains quite lightweight considering its power. The necessary functionality has been wrapped by a new static class called: JError.
For an overview of how patError works please see: http://www.php-tools.net/site.php?&file ... erview.xml
For online documentation of patError please see: http://www.php-tools.net/site.php?&file ... /intro.xml
Obviously we will be creating our own documentation and a how-to guide for third party developers as well. The JError class can be seen in the file: JROOT/libraries/joomla/classes/error.php
A couple of the advantages of using this class will be that all error conditions will have a universal look/feel for the user, and if used properly the user would have exactly the information needed for a developer to fix a bug.
Also, an error system template has been created for displaying errors. This goes a long way to keeping Joomla looking good, even in the worst of times
Obviously more information to come...
Louis
I thought I would quickly go over one of the changes in the upcoming 1.5 release. Though it was not part of the original roadmap for 1.5, the team determined that it would be beneficial to have a common error manager in Joomla. This would provide a common interface for both the core and 3rd party developers to handle errors. After some research was done, the decision was made to wrap the existing patError class that is packaged with patTemplate. This system provides a whole host of functionality and remains quite lightweight considering its power. The necessary functionality has been wrapped by a new static class called: JError.
For an overview of how patError works please see: http://www.php-tools.net/site.php?&file ... erview.xml
For online documentation of patError please see: http://www.php-tools.net/site.php?&file ... /intro.xml
Obviously we will be creating our own documentation and a how-to guide for third party developers as well. The JError class can be seen in the file: JROOT/libraries/joomla/classes/error.php
A couple of the advantages of using this class will be that all error conditions will have a universal look/feel for the user, and if used properly the user would have exactly the information needed for a developer to fix a bug.
Also, an error system template has been created for displaying errors. This goes a long way to keeping Joomla looking good, even in the worst of times
Obviously more information to come...
Louis
Last edited by Jinx on Sat Apr 01, 2006 11:35 pm, edited 1 time in total.
Joomla Platform Maintainer
A hacker does for love what others would not do for money.
A hacker does for love what others would not do for money.
- interfaSys
- Joomla! Apprentice
- Posts: 18
- Joined: Fri Aug 19, 2005 12:15 am
- Location: Lausanne, Switzerland
- Contact:
- DumbAss
- Joomla! Apprentice
- Posts: 21
- Joined: Sat Oct 08, 2005 12:17 pm
Re: API - Error Management in Joomla 1.1
Sounds greet indead. For developers it's very welcome and I hope it speeds up development. Error handling eats up most of my time :P
- torkil
- Joomla! Guru
- Posts: 726
- Joined: Wed Aug 24, 2005 9:34 am
- Location: Rørvik, Norway
- Contact:
Re: API - Error Management in Joomla 1.1
Sounds great. Some examples on how to put it to good use in a joomla application would be nice... Or some pointers to core Joomla code that uses it perhaps?
- Jinx
- Joomla! Champion
- Posts: 6508
- Joined: Fri Aug 12, 2005 12:47 am
- Contact:
Re: API - Error Management in Joomla 1.1
We will try to provide more documentation in the coming weeks. The error handlers are used in the different classes in the framework. A good start is the JFTP class.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5
http://www.joomlatools.com - Joomla extensions that just work
http://www.joomlatools.com - Joomla extensions that just work
- torkil
- Joomla! Guru
- Posts: 726
- Joined: Wed Aug 24, 2005 9:34 am
- Location: Rørvik, Norway
- Contact:
Re: API - Error Management in Joomla 1.1
The JFTP class ideed uses the JError class extensively. I still have to probe a bit further on these error codes....
To sum up: How does one put the error codes to good use when developing third party components?
For instance, from the mkdir function in the JFTP class there is this line of code:
Why is the error code 35 used in here? What good does it do? What does it refer to? Will this result in a 500 error since it is not a 403 or 404?
Louis wrote this paragraph in the dev blog:
To sum up: How does one put the error codes to good use when developing third party components?
For instance, from the mkdir function in the JFTP class there is this line of code:
Code: Select all
JError::raiseError('35', 'JFTP::mkdir: Bad response.', 'Server response:'.$this->_response.' [Expected: 257] Path sent:'.$path );
Louis wrote this paragraph in the dev blog:
Does he mean "...if access isn't forbidden and the page is available..." (403 or 404) then the error is an internal server error (500)?The default case for errors is a 500 error, because if access isn’t forbidden or the page is not available… obviously there is something wrong within the Joomla! code execution so its an internal server error… make sense? Good.
- PhilTaylor-Prazgod
- Joomla! Ace
- Posts: 1403
- Joined: Sat Aug 20, 2005 12:32 pm
- Location: Jersey, Channel Islands
- Contact:
Re: API - Error Management in Joomla 1.5
The links the documentation and overview are not correct after the recent change on their site:
Try this instead:
http://trac.php-tools.net/patError/wiki
http://trac.php-tools.net/patError/wiki/Docs
Try this instead:
http://trac.php-tools.net/patError/wiki
http://trac.php-tools.net/patError/wiki/Docs
Phil Taylor
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/
- https://mySites.guru - Manage Multiple Joomla/WordPress Sites In One Dashboard for Security, Audits, Backups and more....
- https://www.phil-taylor.com/
- Chris Davenport
- Joomla! Ace
- Posts: 1370
- Joined: Thu Aug 18, 2005 8:57 am
- Location: Shrewsbury, Shropshire, United Kingdom
Re: API - Error Management in Joomla 1.5
I've fixed the only link I know about (http://dev.joomla.org/component/option, ... es:jerror/).PhilTaylor-Prazgod wrote: The links the documentation and overview are not correct after the recent change on their site:
Please let me know if you are aware of any other bad links.
Thanks Phil.
Regards,
Chris.
Chris Davenport
Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/
- Chris Davenport
- Joomla! Ace
- Posts: 1370
- Joined: Thu Aug 18, 2005 8:57 am
- Location: Shrewsbury, Shropshire, United Kingdom
Re: API - Error Management in Joomla 1.5
Hi,
Just thought I'd add a quick note to say that the JError class is no longer dependent on patError.
If someone has the time to re-read and revise (or even extend!) the Joomla! Error Handling guidelines page: http://dev.joomla.org/component/option, ... es:jerror/ I would be very grateful.
Please submit your amendments here: http://forum.joomla.org/index.php/board,287.0.html.
Regards,
Chris.
Just thought I'd add a quick note to say that the JError class is no longer dependent on patError.
If someone has the time to re-read and revise (or even extend!) the Joomla! Error Handling guidelines page: http://dev.joomla.org/component/option, ... es:jerror/ I would be very grateful.
Please submit your amendments here: http://forum.joomla.org/index.php/board,287.0.html.
Regards,
Chris.
Chris Davenport
Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/
Davenport Technology Services http://www.davenporttechnology.com/
Lion Coppice http://www.lioncoppice.org/
-
- Joomla! Intern
- Posts: 71
- Joined: Mon Sep 12, 2005 7:54 am
Re: API - Error Management in Joomla 1.5
I tried executing a mysql query after calling JError::raiseError(); to log errors, but it looks like it doesn't work. Does raising an error block mysql queries? The specific method I was calling is insertObject.
Regards,
Todd
Regards,
Todd
-
- Joomla! Explorer
- Posts: 347
- Joined: Wed Sep 27, 2006 11:55 pm
Re: API - Error Management in Joomla 1.5
I think Exceptions would be a great addition. The next version should go fully PHP5.
- torkil
- Joomla! Guru
- Posts: 726
- Joined: Wed Aug 24, 2005 9:34 am
- Location: Rørvik, Norway
- Contact:
Re: API - Error Management in Joomla 1.5
Nothing wrong with using regular PHP Exceptions. JError::isError($obj) is fully capable of determining if $obj is a JException, JError og regular PHP Exception object.
Note:
JException also uses the same function names as the regular PHP Exception class, so it doesn't even take any time getting used to
Note:
JException also uses the same function names as the regular PHP Exception class, so it doesn't even take any time getting used to
Last edited by torkil on Wed Mar 26, 2008 11:28 am, edited 1 time in total.
- torkil
- Joomla! Guru
- Posts: 726
- Joined: Wed Aug 24, 2005 9:34 am
- Location: Rørvik, Norway
- Contact:
Re: API - Error Management in Joomla 1.5
I have another question though, related to errors:
How is the JObject error functions intended to work into this? Most classes inherit from JObject and can thus use the error-related functions from JObject, but what is the thought behind for instance setError, getError and getErrors? Are we supposed to use this as a storing mechanism for storing multiple errors?
How is the JObject error functions intended to work into this? Most classes inherit from JObject and can thus use the error-related functions from JObject, but what is the thought behind for instance setError, getError and getErrors? Are we supposed to use this as a storing mechanism for storing multiple errors?
- Jinx
- Joomla! Champion
- Posts: 6508
- Joined: Fri Aug 12, 2005 12:47 am
- Contact:
Re: API - Error Management in Joomla 1.5
Yes, the idea is that you can store multiple errors in the object. These errors can be errors, notices, warnings or messages and can be retrieved to be acted upon.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5
http://www.joomlatools.com - Joomla extensions that just work
http://www.joomlatools.com - Joomla extensions that just work
-
- Joomla! Apprentice
- Posts: 38
- Joined: Fri Jul 24, 2009 8:35 am
- Contact:
Re: API - Error Management in Joomla 1.5
This sounds great... I hope er can use it soon .Jinx wrote:Yes, the idea is that you can store multiple errors in the object. These errors can be errors, notices, warnings or messages and can be retrieved to be acted upon.
-
- Joomla! Apprentice
- Posts: 9
- Joined: Wed Aug 25, 2010 8:59 am
Re: API - Error Management in Joomla 1.1
I just wanted to update error management thread with couple of resources for developers, since I see nobody done it:Jinx wrote:We will try to provide more documentation in the coming weeks. The error handlers are used in the different classes in the framework. A good start is the JFTP class.
http://api.joomla.org/Joomla-Framework/ ... Error.html
http://docs.joomla.org/JError
Regards