package com.yunfeiyun.agmp.common.exception;

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

/**
 * 文件上传异常类
 * 
 * @author 杨晓辉
 */
public class FileUploadException extends BaseException
{

    private static final long serialVersionUID = 1L;

    private  Throwable cause = null;

    public FileUploadException()
    {
        this(null, null);
    }

    public FileUploadException(final String msg)
    {
        this(msg, null,null,null);
    }

    public FileUploadException(String msg, Throwable cause)
    {
        this(msg, null,null,null);
        this.cause = cause;
    }


    public FileUploadException(String code, String msg,  String msgKey , Object[] data)
    {
        super(code, msg, msgKey,data);
    }

    @Override
    public void printStackTrace(PrintStream stream)
    {
        super.printStackTrace(stream);
        if (cause != null)
        {
            stream.println("Caused by:");
            cause.printStackTrace(stream);
        }
    }

    @Override
    public void printStackTrace(PrintWriter writer)
    {
        super.printStackTrace(writer);
        if (cause != null)
        {
            writer.println("Caused by:");
            cause.printStackTrace(writer);
        }
    }

    @Override
    public Throwable getCause()
    {
        return cause;
    }
}
