Tag Archives: Exception handling

Default Error Handling in Zend Framework

Zend_Controller_Action_Exception

There’s a cool feature in Zend Framework when a controller or action doesn’t exists. That’s really useful, because you simply write an ErrorController.php in you default module and every action’s exception sends the user to this controller/action and the job is done for you. What is important here is to show the error message at least on the development stage. Actually the request stores it as a parameter. Here’s some source:

<?php
 
class ErrorController extends Zend_Controller_Action
{
    public function errorAction()
    {
        $errorHandler = $this->getRequest()->getParam('error_handler');
        /* @var $error Zend_Controller_Action_Exception */
        $error = $errorHandler->exception;
        echo $error->getMessage();
    }
}

Google Closure Compiler doesn’t work?!

What are these strange java errors?

No, it works but maybe the problem is you current Java version. The Google Closure Compiler requires 1.6 and most commonly you’re runing on 1.5 therefore it produces errors. It was my problem when I tried to run the application. At that moment it produced these lines of errors:

java -jar compiler.jar --help

Exception in thread “main” java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)

Just update or switch your current Java version to 1.6 and everything will be fine!