Improved error handler

This extension is now merged into Yii core and will be included in 1.1.6.

A bit improved error handler. For now it can show trace call arguments, show

if method is called statically or dynamically and generally a bit more cleaner.

If you don’t want to install it, just check these screenshots:

  • Standard error handler

  • New error handler

Installation

Check out code from SVN into protected/extensions/yiiext/components/improvedErrorHandler.

Add to your main.php into components section:


'components'=>array(

	…

	'errorHandler' => array(

		'class' => 'ext.yiiext.components.improvedErrorHandler.EImprovedErrorHandler'

	),

),

Do you want something like this one in Yii core? Any suggestions or recommendations?

Any improvement like this would be nice to have in the core…

Looks very good. I like that it shows more call arguments. Any objections why this should not go into the core?

Seem to be very good and very readable. Just one thing:

In old:

stack trace #2 says:




CActiveRecord->query(object(CDbCriteria),true);



while in new says:




CActiveRecord->query(CDbCriteria,1);



It would be good and more readable is says this instead:




CActiveRecord->query(CDbCriteria,true);



Very good work!!!

One problem with the current error handler is that the stack trace is very hard to read so I definitely think that the new one is better.

I also would like to have the data types taken into account when outputting arguments as PoL mentioned.

Very good work indeed.

I like it better than the core error handler. As other people asked: why not put this in the core?

There’s one potential drawback i see. The standard error handler only displays “Array” as call argument, while samdark’s shows the content of that array. This will work pretty well for simple array, but could smash the trace layout if the array contains lot of values or long strings.

Yes i agree looks much better… does anybody use the stack trace now? I mostly ignore it because it is not readable… and gives too much info i dont need :)

Of course - and i wonder how someone can seriously try to debug without the stack trace :). I think it’s a little extreme to call it “not readable” - just take your time to get used to it and understand all the information it provides. But there’s always room for improvement ;).

OK, I see that feedback is generally positive. Thanks.

Are there other things that will be useful when debugging? Are there things you don’t like?

Yeah, I use the stack trace pretty often but it’s really hard to read. It would be great if you could easily see the filename, line number, function called and the arguments, which you cannot at the moment.

Yeah, I would like it if the filename and line number were bold in the stack trace, as that’s the most important part (generally in Yii you don’t have files with the same name so you don’t need to know the path)

Chris83, jonah

You are checking code in these files, right? What if it will display some code like it does for latest error?

Yeah, that would be cool, but you would have to be careful about screen estate. That would be a lot of information. Maybe if there were expand/collapse buttons to view the code, with the code hidden by default. Just like on google code: http://code.google.com/p/yii/source/detail?r=2280

Highlighting application file names would improve readibility a lot.

/Tommy

Yes…Thank you for this :)

More readable indeed

at a first impression it looks very good and readable

since you asked for things we’d like to see in the stacktrace:

when a mysql-error is thrown i want to see the full sql-query with all variables + the sql-errormessage

and my own stuff should be highlighted somehow (light blue background or something like that)… cause 99% of the errors are from me (:

Definitely more readable than current stack trace (and I use stack trace a lot !). Nice to have in the core.

8)

Thx alot for this extention.

May be show some environment variables should be shown in expand/collapse maner ?

where is argumentsToString() called though? it’s a protected function that only call itself.