referee icon indicating copy to clipboard operation
referee copied to clipboard

Cake's onscreen errors are gone

Open Phally opened this issue 15 years ago • 2 comments

Hey,

It is nice and all that it logs to log files and database, but that is primarily for production environments.

When developing it is nice to have errors on the screen, preferably without disabling (commenting out) the component.

For this I made a simple listener that calls the Cake error handler, you might want to add it to the default listeners:

http://github.com/Phally/referee/commit/906521acb43b330a107983c72d8f3cd49e0c778b

By the way, have you considered using an interface for the Listeners?

Phally avatar Aug 05 '10 08:08 Phally

There was a way in the older version to make sure that Cake's ErrorHandler received messages as Referee did but it seemed to be bothersome at some point. I do like the idea of adding a listener to replace this functionality.

I sure have but I'm of the persuasion that abstract classes are similar, if not better than interfaces.

joebeeson avatar Aug 05 '10 15:08 joebeeson

Yeah, I remember that, it was a pain and I am glad you removed that. Screwed with the layout iirc.

Surely an abstract class will do it too, but since it will (I think) never contain any code that has to be shared across all Listeners, I would say an interface would be good. Plus the error method will always contain Listener specific code, which means it will always be implemented and therefor I would still pick the interface.

An example of a proper abstract class is DboSource or AppController for example. Those contain code, but will never be instantiated, they must be overridden.

Phally avatar Aug 05 '10 15:08 Phally