All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.protostuff.compiler.parser.ParserException Maven / Gradle / Ivy

The newest version!
package io.protostuff.compiler.parser;

import io.protostuff.compiler.model.Element;
import io.protostuff.compiler.model.SourceCodeLocation;

/**
 * Exception for parse errors.
 * Contains source code location of an error.
 *
 * @author Kostiantyn Shchepanovskyi
 */
public class ParserException extends RuntimeException {

    private final SourceCodeLocation sourceCodeLocation;

    public ParserException(Element sourceElement, String format, Object... args) {
        super(String.format(format, args) + " [" + sourceElement.getSourceCodeLocation() + "]");
        this.sourceCodeLocation = sourceElement.getSourceCodeLocation();
    }

    public ParserException(String format, Object... args) {
        super(String.format(format, args));
        sourceCodeLocation = SourceCodeLocation.UNKNOWN;
    }

    public SourceCodeLocation getSourceCodeLocation() {
        return sourceCodeLocation;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy