/*
 * @(#)TelnetTaskTimeoutException.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.telnet;

/**
 * A subclass of TelnetException, this exception is thrown by a TelnetSession
 * instance when using the TelnetSession#send or TelnetSession#sendWait methods
 * and the TelnetTask exceeds the maximum defined timeout waiting for either the
 * start prompt or end prompt.
 */
public class TelnetTaskTimeoutException
        extends TelnetException {

    private TelnetTask task;

    /**
     * Constructs a new TelnetTaskTimeoutException instance
     *
     * @param task the TelnetTask that timed out
     *
     * @see TelnetTask
     */
    public TelnetTaskTimeoutException(TelnetTask task) {
        super("Exceeded task timeout of " + task.getEndPromptTimeout() + "ms waiting for prompt.");
        this.task = task;
    }

    /**
     * Gets the TelnetTask that timed out
     *
     * @return the TelnetTask
     *
     * @see TelnetTask
     */
    public TelnetTask getTask() {
        return task;
    }
}
