/*
 * @(#)SshTaskFailedEvent.java
 *
 * Copyright (c) 2001-2002 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.ssh;

/**
 * Fired when a <code>SshTask</code> has failed to complete
 *
 * @see SshTask
 */
public class SshTaskFailedEvent
        extends SshScriptEvent {

    /**
     * Creates a new instance of SshTaskFailedEvent.
     *
     * @param source    the source of the event
     * @param task      the <code>SshTask</code> that has failed
     *
     * @see SshTask
     */
    public SshTaskFailedEvent(SshScript source, SshTask task) {
        super(source, task);
    }

    /**
     * Gets the exception that caused the SshTask to fail.
     *
     * @return the exception
     */
    public Exception getException() {
        return this.task.getError();
    }

    @Override
    public void accept(SshScriptListener listener) {
        listener.taskFailed(this);
    }
}
