manish143143 / cssmin

Automatically exported from code.google.com/p/cssmin
0 stars 0 forks source link

Implement a more unobtrusive error reporting #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm debugging something inside a library which uses your library and I came 
around to notice that you use trigger_error() to elavate issues from your code.

I assume that you trigger_error() to not halt the code, but trigger_error 
pollutes log files and I think unless I implement a custom error handler to 
handle E_USER_WARNING from your code, there's no way for me to collect these 
errors or even handle them - or disregard them entirely.

So instead of using trigger_error() in your code, I'd like to propose some form 
of global error object or maybe a class variable which collects all errors, and 
in the end, I can ask with hasError() and getErrors() to see them.

Would you be open to this?

    class CssMin_Errors
    {
        /**
         * @var array
         */
        protected $errors;

        /**
         * @return CssMin_Errors
         */
        public static function getInstance();

        /**
         * @param string $error
         * @return $this
         */
        public function push($error);

        /**
         * @return boolean
         */
        public function is();

        /**
         * @return array
         */
        public function get();

        public function __toString();
    }

Original issue reported on code.google.com by klimp...@gmail.com on 2 Aug 2011 at 8:32

GoogleCodeExporter commented 8 years ago
Thanks for reporting this issue. I'm also not very satisfied with the current 
error reporting ;).

Original comment by joe.scylla on 3 Aug 2011 at 6:35

GoogleCodeExporter commented 8 years ago
Cool, well, let me know if you have any thoughts or want my input on an 
implementation. I'd send you a pull request, but this is svn.

Original comment by klimp...@gmail.com on 3 Aug 2011 at 10:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Fixed in Version 3.0.1 (Revision #163)

See: http://code.google.com/p/cssmin/wiki/WhatsNewVersion301

Original comment by joe.scylla on 19 Aug 2011 at 10:24