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
018package org.apache.commons.jxpath;
019
020/**
021 * Thrown in various situations by JXPath; may contain a nested exception.
022 */
023public class JXPathException extends RuntimeException {
024
025    private static final long serialVersionUID = 2L;
026
027    /**
028     * Constructs a new {@code JXPathException} with no detail mesage.
029     */
030    public JXPathException() {
031    }
032
033    /**
034     * Constructs a new {@code JXPathException} with the {@code String } specified as an error message.
035     *
036     * @param msg The error message for the exception.
037     */
038    public JXPathException(final String msg) {
039        super(msg);
040    }
041
042    /**
043     * Constructs a new {@code JXPathException} with the given {@code Exception} base cause and detail message.
044     *
045     * @param msg The detail message.
046     * @param cause   The exception to be encapsulated in a JXPathException
047     */
048    public JXPathException(final String msg, final Throwable cause) {
049        super(msg, cause);
050    }
051
052    /**
053     * Constructs a new {@code JXPathException} with a given {@code Throwable} base cause of the error.
054     *
055     * @param cause The exception to be encapsulated in a JXPathException.
056     */
057    public JXPathException(final Throwable cause) {
058        super(cause);
059    }
060
061    /**
062     * Gets the actual exception (if any) that caused this exception to be raised.
063     *
064     * @return The encapsulated exception, or null if there is none.
065     */
066    public Throwable getException() {
067        return super.getCause();
068    }
069
070}