/*
 *  Copyright 2006-2009 Mikhail Kryshen
 *
 *  This file is part of Tema.
 *
 *  Tema is free software: you can redistribute it and/or modify it
 *  under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 *  Tema is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the 
 *  GNU Lesser General Public License along with Tema.  
 *  If not, see <http://www.gnu.org/licenses/>.
 */

package kryshen.tema;

import kryshen.tema.io.TemplateReader;

/**
 * Signals that template parsing fails.
 *
 * @author Mikhail Kryshen
 */
public class TemplateException extends Exception {
    //private String source;
    //private int line;

//     public TemplateException(String message) {
// 	super(message);
//     }

//     public TemplateException(String message, Throwable cause) {
// 	super(message, cause);
//     }

    public TemplateException(String message, Throwable cause,
                             TemplateReader tr) {
        this(message, cause, tr.getSource(), tr.getLineNumber() + 1);
    }

    public TemplateException(String message, TemplateReader tr) {
        this(message, tr.getSource(), tr.getLineNumber() + 1);
    }

    public TemplateException(String message, Throwable cause,
                             String source, int line) {
        super(source + ":" + line + ": " + message, cause);
        //this.source = source;
        //this.line = line;
    }
    
    public TemplateException(String message, String source, int line) {
        super(source + ":" + line + ": " + message);
        //this.source = source;
        //this.line = line;
    }
}