001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     * 
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.commons.lang;
018    
019    import org.apache.commons.lang.exception.NestableRuntimeException;
020    
021    /**
022     * <p>Thrown when it is impossible or undesirable to consume or throw a checked exception.</p>
023     * This exception supplements the standard exception classes by providing a more
024     * semantically rich description of the problem.</p>
025     * 
026     * <p><code>UnhandledException</code> represents the case where a method has to deal
027     * with a checked exception but does not wish to.
028     * Instead, the checked exception is rethrown in this unchecked wrapper.</p>
029     * 
030     * <pre>
031     * public void foo() {
032     *   try {
033     *     // do something that throws IOException
034     *   } catch (IOException ex) {
035     *     // don't want to or can't throw IOException from foo()
036     *     throw new UnhandledException(ex);
037     *   }
038     * }
039     * </pre>
040     *
041     * @author Matthew Hawthorne
042     * @since 2.0
043     * @version $Id: UnhandledException.java 437554 2006-08-28 06:21:41Z bayard $
044     */
045    public class UnhandledException extends NestableRuntimeException {
046    
047        /**
048         * Required for serialization support.
049         * 
050         * @see java.io.Serializable
051         */
052        private static final long serialVersionUID = 1832101364842773720L;
053    
054        /**
055         * Constructs the exception using a cause.
056         *
057         * @param cause  the underlying cause
058         */
059        public UnhandledException(Throwable cause) {
060            super(cause);
061        }
062    
063        /**
064         * Constructs the exception using a message and cause.
065         *
066         * @param message  the message to use
067         * @param cause  the underlying cause
068         */
069        public UnhandledException(String message, Throwable cause) {
070            super(message, cause);
071        }
072    
073    }