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

io.imunity.vaadin.endpoint.common.exceptions.ControllerException Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2021 Bixbit - Krzysztof Benedyczak. All rights reserved.
 * See LICENCE.txt file for licensing information.
 */

package io.imunity.vaadin.endpoint.common.exceptions;

/**
 * Thrown to signal UI element about problem with engine operation.
 * 
 * @author P.Piernik
 *
 */
public class ControllerException extends Exception
{
	public enum Type
	{
		WARN, ERROR
	}

	private Type type;
	private String caption;
	
	public ControllerException(String errorCaption, Throwable cause)
	{
		this(Type.ERROR, errorCaption, "", cause);
	}

	public ControllerException(String errorCaption, String errorDetails, Throwable cause)
	{
		this(Type.ERROR, errorCaption, errorDetails, cause);
	}

	public ControllerException(Type type, String errorCaption, String errorDetails,
			Throwable cause)
	{
		super(errorDetails, cause);
		this.caption = errorCaption;
		this.type = type;
	}
	
	public static ControllerException warning(String errorCaption, Throwable cause)
	{
		return new ControllerException(Type.WARN, errorCaption, "", cause);
	}
	
	public static ControllerException warning(String errorCaption)
	{
		return new ControllerException(Type.WARN, errorCaption, "", null);
	}

	public Type getType()
	{
		return type;
	}

	public String getCaption()
	{
		return caption;
	}

	public String getDetails()
	{
		return getMessage();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy