001/**
002 * Powerunit - A JDK1.8 test framework
003 * Copyright (C) 2014 Mathieu Boretti.
004 *
005 * This file is part of Powerunit
006 *
007 * Powerunit is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License as published by
009 * the Free Software Foundation, either version 3 of the License, or
010 * (at your option) any later version.
011 *
012 * Powerunit is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015 * GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with Powerunit. If not, see <http://www.gnu.org/licenses/>.
019 */
020package ch.powerunit.extensions.exceptions;
021
022/**
023 * RuntimeException to wrap the Exception.
024 *
025 */
026public final class WrappedException extends RuntimeException {
027
028        private static final long serialVersionUID = -5914178098082781979L;
029
030        /**
031         * Constructs a new wrapped exception with the specified detail message and
032         * cause.
033         * <p>
034         * Note that the detail message associated with {@code cause} is <i>not</i>
035         * automatically incorporated in this wrapped exception's detail message.
036         *
037         * @param message
038         *            the detail message (which is saved for later retrieval by the
039         *            {@link #getMessage()} method).
040         * @param cause
041         *            the cause (which is saved for later retrieval by the
042         *            {@link #getCause()} method). (A {@code null} value is permitted,
043         *            and indicates that the cause is nonexistent or unknown.)
044         */
045        public WrappedException(String message, Throwable cause) {
046                super(message, cause);
047        }
048
049        /**
050         * Constructs a new wrapped exception with the specified detail message. The
051         * cause is not initialized, and may subsequently be initialized by a call to
052         * {@link #initCause}.
053         *
054         * @param message
055         *            the detail message. The detail message is saved for later
056         *            retrieval by the {@link #getMessage()} method.
057         */
058        public WrappedException(String message) {
059                super(message);
060        }
061
062        /**
063         * Constructs a new wrapped exception with the specified cause and a detail
064         * message of {@code (cause.getMessage())}
065         *
066         * @param cause
067         *            the cause (which is saved for later retrieval by the
068         *            {@link #getCause()} method).
069         */
070        public WrappedException(Throwable cause) {
071                super(cause.getMessage(), cause);
072        }
073
074}