[dev] Whups Links (Patch)
Chuck Hagenbuch
chuck at horde.org
Tue Mar 4 23:22:26 PST 2003
Quoting j.huinink at wanadoo.nl:
> The following patch implements linking from whups (into Turba!). There is
> no linking into whups yet.
Overall, *nice*! I have this working well and the possiblities are pretty
fun to imagine. :) It's committed.
The minor CODING_STANDARDS lessons for the day are:
Function declaractions follow the "one true brace" convention:
function fooFunction($arg1, $arg2 = '')
{
if (condition) {
statement;
}
return $val;
}
(from [4] Function Definitions)
... and:
-------------------
[22] Error checking
===================
Horde code should use PEAR_Error objects to return most error
conditions from library calls, and many times we will simply pass back
a PEAR_Error object generated by an underlying library (such as Mail
or PEAR DB).
For these cases, use the following style of code block to check for
success after any call which could generate an error condition:
$result = $something->call('may error');
if (is_a($result, 'PEAR_Error')) {
// Handle error condition.
} else {
// Succeeded.
}
Note that is_a() checks for subclasses of the named class, as well, so
if the object you get back is really a DB_Error object, this will
still catch it (since DB_Error extends PEAR_Error).
Again, good stuff overall - thanks!
-chuck
--
Charles Hagenbuch, <chuck at horde.org>
I know there's fish out there, but where g-d only knows.
More information about the dev
mailing list