OpenNebulaConfigurationError.java

This version does not break legacy code. - Gian Uberto Lauri, 04/11/2011 05:27 PM

Download (1.62 KB)

 
1
package org.opennebula.client;
2

    
3
/**
4
 * OpenNebulaConfigurationException
5
 *
6
 * Thrown whenever the configuration  contains errors that prevent the
7
 * instantiations of a Client instance.
8
 *
9
 * This should have been a subclass of Error, since there's no chance
10
 * you can fix the situation from within the code, you have to stop
11
 * the JVM, fix the configuration and restart.
12
 *
13
 * "An Error is a subclass of Throwable that indicates serious
14
 * problems that a reasonable application should not try to
15
 * catch. Most such errors are abnormal conditions. The ThreadDeath
16
 * error, though a "normal" condition, is also a subclass of Error
17
 * because most applications should not try to catch it.
18
 *
19
 * A method is not required to declare in its throws clause any
20
 * subclasses of Error that might be thrown during the execution of
21
 * the method but not caught, since these errors are abnormal
22
 * conditions that should never occur."
23
 * 
24
 * (from Error class documentation)
25
 *
26
 * Why RuntimeException ? Because RuntimeExceptions are unchecked (you
27
 * should not write a catch block for
28
 * OpenNebulaConfigurationException) and are a subclass of Exception,
29
 * therefore they do not break previous code, while Error comes from
30
 * Throwable and that breaks catch(Exception e) blocks in legacy code.
31
 *
32
 * Created: Mon Apr 11 18:43:53 2011
33
 *
34
 * @author <a href="mailto:saint@eng.it">Gian Uberto Lauri</a>
35
 * @version $Revision$
36
 */
37
public class OpenNebulaConfigurationError extends RuntimeException {
38

    
39
        /**
40
         * Creates a new instance of <code>OpenNebulaConfigurationError</code> .
41
         *
42
         */
43
        public OpenNebulaConfigurationError(String message) {
44
                super(message);
45
        }
46

    
47
}