/*
 * @(#)SftpException.java
 *
 * Copyright (c) 2001-2004 JScape
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JScape. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with JScape.
 */


package com.jscape.inet.sftp;

import com.jscape.util.SuppressObfuscation;

import java.io.IOException;

/**
 * SftpException is thrown by many methods of the Sftp class. The methods
 * are masking various exception types into SftpException, but the event
 * message will be propagated.
 */
@SuppressObfuscation
public class SftpException
        extends IOException {

    private static final long serialVersionUID = -2096199834119721214L;

    public static SftpException wrap(Throwable e) {
        return e instanceof SftpException ? (SftpException) e : new SftpException(e);
    }

    public SftpException() {
    }

    /**
     * Creates a new SftpException with specified exception message.
     *
     * @param message the exception message.
     */
    public SftpException(String message) {
        super(message);
    }

    /**
     * Creates a new SftpException and store the original message and exception.
     *
     * @param message The exception message
     * @param cause   The exception which caused this exception
     */
    public SftpException(String message, Throwable cause) {
        super(message, cause);
    }

    public SftpException(Throwable cause) {
        super(cause.getMessage() != null ? cause.getMessage() : cause.toString(), cause);
    }


}
