001 /**
002 * <copyright>
003 *
004 * Copyright (c) 2002-2006 IBM Corporation and others.
005 * All rights reserved. This program and the accompanying materials
006 * are made available under the terms of the Eclipse Public License v1.0
007 * which accompanies this distribution, and is available at
008 * http://www.eclipse.org/legal/epl-v10.html
009 *
010 * Contributors:
011 * IBM - Initial API and implementation
012 *
013 * </copyright>
014 *
015 * $Id: WrappedException.java,v 1.5 2006/12/05 20:19:56 emerks Exp $
016 */
017 package org.eclipse.emf.common.util;
018
019
020 /**
021 * A runtime exception that wraps another exception.
022 */
023 public class WrappedException extends RuntimeException
024 {
025 private static final long serialVersionUID = 1L;
026
027 /**
028 * Creates an instance that wraps the exception.
029 */
030 public WrappedException(Exception exception)
031 {
032 super(exception);
033 }
034
035 /**
036 * Creates an instance with it's own message that wraps the exception.
037 * @param message the message.
038 * @param exception the exception to wrap.
039 */
040 public WrappedException(String message, Exception exception)
041 {
042 super(message, exception);
043 }
044
045 /**
046 * Returns the wrapped exception.
047 * @return the wrapped exception.
048 */
049 public Exception exception()
050 {
051 return (Exception)getCause();
052 }
053 }