01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.commons.lang;
18:
19: import org.apache.commons.lang.exception.NestableRuntimeException;
20:
21: /**
22: * <p>Thrown when it is impossible or undesirable to consume or throw a checked exception.</p>
23: * This exception supplements the standard exception classes by providing a more
24: * semantically rich description of the problem.</p>
25: *
26: * <p><code>UnhandledException</code> represents the case where a method has to deal
27: * with a checked exception but does not wish to.
28: * Instead, the checked exception is rethrown in this unchecked wrapper.</p>
29: *
30: * <pre>
31: * public void foo() {
32: * try {
33: * // do something that throws IOException
34: * } catch (IOException ex) {
35: * // don't want to or can't throw IOException from foo()
36: * throw new UnhandledException(ex);
37: * }
38: * }
39: * </pre>
40: *
41: * @author Matthew Hawthorne
42: * @since 2.0
43: * @version $Id: UnhandledException.java 437554 2006-08-28 06:21:41Z bayard $
44: */
45: public class UnhandledException extends NestableRuntimeException {
46:
47: /**
48: * Required for serialization support.
49: *
50: * @see java.io.Serializable
51: */
52: private static final long serialVersionUID = 1832101364842773720L;
53:
54: /**
55: * Constructs the exception using a cause.
56: *
57: * @param cause the underlying cause
58: */
59: public UnhandledException(Throwable cause) {
60: super (cause);
61: }
62:
63: /**
64: * Constructs the exception using a message and cause.
65: *
66: * @param message the message to use
67: * @param cause the underlying cause
68: */
69: public UnhandledException(String message, Throwable cause) {
70: super(message, cause);
71: }
72:
73: }
|