John,
Today, I totally understand what you were saying. Basically, our Zend::exception() function should call the setLine/setFile methods of Zend_Exception so that when an uncaught exception reaches php, that php's uncaught exception errors reflect the correct Line and File numberings.

I must agree though, that as of right now, this appears to be a big problem. Effectively, we have broken and bastardized the way Exceptions work in PHP when using this framework. What this does is send developers on an easter egg hunt through code simply b/c there is an uncaught exception.

Notice how not wrapping my $controller->dispatch() throws an exception with meaningless information:

Zend_Controller_Dispatcher_Exception: "existent_route" controller does not exist in /home/ralph/projects/dvstats/application/library/Zend.php on line 266

The fact that there is an ExistentRouteController in the proper place and correctly defined is another topic for a different moment ;)

But this illustrates how I might anticipate developers complaining about misleading exception messages bubbling up from php.

Any chance we can find a solution to this pre-1.0?

-ralph


John Coggeshall wrote:
No I'm not, I'm saying basically what you are -- the framework should be
repointing the exception to the correct location. I'm simply implying that
for "internal" ZF exceptions we can afford to pass the __LINE__ or __FILE__
in the code. If this can be done transparently from the exception base class
in a factory model (I believe it can) then that makes the most sense.
John

--
John Coggeshall
Team Lead NA Pro. Services
Zend Technologies
-----Original Message-----
From: Ralph Schindler [mailto:[EMAIL PROTECTED] Sent: Monday, December 18, 2006 1:32 PM
To: [EMAIL PROTECTED]
Cc: 'Zend Framework General'
Subject: Re: [fw-general] Re: Do we really need Zend::exception()?

In this situation you are offloading the setting to the user which could be cumbersome.

I guess now that ive got 2 eyes fixed on the current solution, I wonder why ::exception lives in the Zend class and not in the Zend_Exception class? Wouldn't it make more sense to have Zend_Exception::factory($class, $message); ?

This factory method would do the trace lookback (after parent Exception construction) to determine the line and file number that called it, and perhaps that is stored in local protected variables $callerFile, and $callerLine.

I guess I could sort of understand the arguement that Zend::exception() is easier to write than Zend_Exception::factory, but to me, I opt for logical organization over convienence at the core level. After this is written, this code wont change much in the library.

My 2cents ;)
-ralph

John Coggeshall wrote:
Exception() base doesn't include the method, but the properties ($e->line, and $e->file I *believe*, check the docs) are
protected so
you should be able to implement your own setFile() and setLine() methods from the extended Zend_Exception.

John

--
John Coggeshall
Team Lead NA Pro. Services
Zend Technologies




Reply via email to