001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.common.text;
017
018/**
019 * An exception representing a problem during parsing of text.
020 */
021public class ParsingException extends RuntimeException {
022    private static final long serialVersionUID = 1L;
023
024    private final Position position;
025
026    /**
027     * @param position the position of the error; never null
028     */
029    public ParsingException( Position position ) {
030        super();
031        this.position = position;
032    }
033
034    /**
035     * @param position the position of the error; never null
036     * @param message the message
037     * @param cause the underlying cause
038     */
039    public ParsingException( Position position,
040                             String message,
041                             Throwable cause ) {
042        super(message, cause);
043        this.position = position;
044    }
045
046    /**
047     * @param position the position of the error; never null
048     * @param message the message
049     */
050    public ParsingException( Position position,
051                             String message ) {
052        super(message);
053        this.position = position;
054    }
055
056    public Position getPosition() {
057        return position;
058    }
059}