/*
 * Decompiled with CFR 0.152.
 */
package com.hst.common.exception;

import java.io.PrintStream;
import java.io.PrintWriter;

public class NestableException
extends Exception {
    private static final long serialVersionUID = 1L;
    private Throwable _cause;

    public NestableException() {
    }

    public NestableException(String message, Throwable cause) {
        super(message);
        this._cause = cause;
    }

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

    public NestableException(Throwable cause) {
        this("This exception caused by  " + (cause == null ? "unknow exception" : cause.toString()), cause);
    }

    @Override
    public void printStackTrace() {
        this.printStackTrace(System.err);
    }

    @Override
    public void printStackTrace(PrintStream s) {
        if (this._cause != null) {
            this._cause.printStackTrace(s);
        }
        super.printStackTrace(s);
    }

    @Override
    public void printStackTrace(PrintWriter s) {
        if (this._cause != null) {
            this._cause.printStackTrace(s);
        }
        super.printStackTrace(s);
    }

    @Override
    public Throwable getCause() {
        return this._cause;
    }
}
