123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
/*******************************************************************************
  copyright:   Copyright (c) 2006 Juan Jose Comellas. All rights reserved
  license:     BSD style: $(LICENSE)
  author:      Juan Jose Comellas $(EMAIL juanjo@comellas.com.ar)
*******************************************************************************/

module tango.io.selector.SelectorException;

//private import tango.core.Exception;


/**
 * SelectorException is thrown when the Selector cannot be created because
 * of insufficient resources (file descriptors, memory, etc.)
 */
public class SelectorException: Exception
{
    /**
     * Construct a selector exception with the provided text string
     *
     * Params:
     * file     = name of the source file where the exception was thrown; you
     *            would normally use __FILE__ for this parameter.
     * line     = line number of the source file where the exception was
     *            thrown; you would normally use __LINE__ for this parameter.
     */
    public this(string msg, string file, size_t line)
    {
        super(msg, file, line);
    }
}


/**
 * UnregisteredConduitException is thrown when the selector looks for a
 * registered conduit and it cannot find it.
 */
public class UnregisteredConduitException: SelectorException
{
    /**
     * Construct a selector exception with the provided text string
     *
     * Params:
     * file     = name of the source file where the exception was thrown; you
     *            would normally use __FILE__ for this parameter.
     * line     = line number of the source file where the exception was
     *            thrown; you would normally use __LINE__ for this parameter.
     */
    public this(string file, size_t line)
    {
        super("The conduit is not registered to the selector", file, line);
    }
}

/**
 * RegisteredConduitException is thrown when a selector detects that a conduit
 * registration was attempted more than once.
 */
public class RegisteredConduitException: SelectorException
{
    /**
     * Construct a selector exception with the provided text string
     *
     * Params:
     * file     = name of the source file where the exception was thrown; you
     *            would normally use __FILE__ for this parameter.
     * line     = line number of the source file where the exception was
     *            thrown; you would normally use __LINE__ for this parameter.
     */
    public this(string file, size_t line)
    {
        super("The conduit is already registered to the selector", file, line);
    }
}

/**
 * InterruptedSystemCallException is thrown when a system call is interrupted
 * by a signal and the selector was not set to restart it automatically.
 */
public class InterruptedSystemCallException: SelectorException
{
    /**
     * Construct a selector exception with the provided text string
     *
     * Params:
     * file     = name of the source file where the exception was thrown; you
     *            would normally use __FILE__ for this parameter.
     * line     = line number of the source file where the exception was
     *            thrown; you would normally use __LINE__ for this parameter.
     */
    public this(string file, size_t line)
    {
        super("A system call was interrupted by a signal", file, line);
    }
}

/**
 * OutOfMemoryException is thrown when there is not enough memory.
 */
public class OutOfMemoryException: SelectorException
{
    /**
     * Construct a selector exception with the provided text string
     *
     * Params:
     * file     = name of the source file where the exception was thrown; you
     *            would normally use __FILE__ for this parameter.
     * line     = line number of the source file where the exception was
     *            thrown; you would normally use __LINE__ for this parameter.
     */
    public this(string file, size_t line)
    {
        super("Out of memory", file, line);
    }
}