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

org.eclipse.epsilon.eol.exceptions.EolParseException Maven / Gradle / Ivy

/*********************************************************************
 * Copyright (c) 2019 The University of York.
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.epsilon.eol.exceptions;

import java.util.Collection;
import org.eclipse.epsilon.common.parse.problem.ParseProblem;

/**
 *
 *
 * @author Sina Madani
 * @since 1.6
 */
public class EolParseException extends Exception {

	protected final Collection parseProblems;
	
	public EolParseException() {
		this("Parse problems found!");
	}

	public EolParseException(String message) {
		this(message, null);
	}

	public EolParseException(Collection problems) {
		this(null, problems);
	}
	
	public EolParseException(String message, Collection problems) {
		super(message);
		this.parseProblems = problems;
	}
	
	@Override
	public String getMessage() {
		String detail = super.getMessage();
		if (detail == null) detail = "";
		if (parseProblems != null && !parseProblems.isEmpty()) {
			for (ParseProblem pp : parseProblems) {
				detail += System.lineSeparator() + pp.toString();
			}
		}
		return detail;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy