/*
 * This file (LabelPrintException.java) is part of DebGen-LabelPrintLib  developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 *  Copyright ASTRID Research, Hungary, 2010.
 *
 *  ASTRID Research
 *  Headquaters: Csapó utca 42. Debrecen H-4029 HUNGARY
 *  Phone: +36-52-533-173        Fax: +36-52-533-174
 *  Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DEBGEN-Biobank-Project.
 * File last modified at 2010.01.08 14:04
 */

package hu.astrid.debgen.labelprint.exception;

/**
 * @author inagy
 */
public class LabelPrintException extends Exception {

    private String message;
    private Exception ex;

    public LabelPrintException(Exception ex) {
        message = null;
        this.ex = ex;
    }

    public LabelPrintException(String message) {
        this.message = message;
        ex = null;
    }

    public LabelPrintException(Exception ex, String message) {
        this.message = message;
        this.ex = ex;
        ex.printStackTrace();
    }

    public Exception getRootCause() {
        return ex;
    }

    @Override
    public String getMessage() {
        if (message != null) {
            return message;
        } else {
            return ex.getMessage();
        }
    }
}
