1 /*******************************************************************************
2   copyright:   Copyright (c) 2006 Juan Jose Comellas. All rights reserved
3   license:     BSD style: $(LICENSE)
4   author:      Juan Jose Comellas $(EMAIL juanjo@comellas.com.ar)
5 *******************************************************************************/
6 
7 module tango.io.selector.SelectorException;
8 
9 //private import tango.core.Exception;
10 
11 
12 /**
13  * SelectorException is thrown when the Selector cannot be created because
14  * of insufficient resources (file descriptors, memory, etc.)
15  */
16 public class SelectorException: Exception
17 {
18     /**
19      * Construct a selector exception with the provided text string
20      *
21      * Params:
22      * file     = name of the source file where the exception was thrown; you
23      *            would normally use __FILE__ for this parameter.
24      * line     = line number of the source file where the exception was
25      *            thrown; you would normally use __LINE__ for this parameter.
26      */
27     public this(string msg, string file, size_t line)
28     {
29         super(msg, file, line);
30     }
31 }
32 
33 
34 /**
35  * UnregisteredConduitException is thrown when the selector looks for a
36  * registered conduit and it cannot find it.
37  */
38 public class UnregisteredConduitException: SelectorException
39 {
40     /**
41      * Construct a selector exception with the provided text string
42      *
43      * Params:
44      * file     = name of the source file where the exception was thrown; you
45      *            would normally use __FILE__ for this parameter.
46      * line     = line number of the source file where the exception was
47      *            thrown; you would normally use __LINE__ for this parameter.
48      */
49     public this(string file, size_t line)
50     {
51         super("The conduit is not registered to the selector", file, line);
52     }
53 }
54 
55 /**
56  * RegisteredConduitException is thrown when a selector detects that a conduit
57  * registration was attempted more than once.
58  */
59 public class RegisteredConduitException: SelectorException
60 {
61     /**
62      * Construct a selector exception with the provided text string
63      *
64      * Params:
65      * file     = name of the source file where the exception was thrown; you
66      *            would normally use __FILE__ for this parameter.
67      * line     = line number of the source file where the exception was
68      *            thrown; you would normally use __LINE__ for this parameter.
69      */
70     public this(string file, size_t line)
71     {
72         super("The conduit is already registered to the selector", file, line);
73     }
74 }
75 
76 /**
77  * InterruptedSystemCallException is thrown when a system call is interrupted
78  * by a signal and the selector was not set to restart it automatically.
79  */
80 public class InterruptedSystemCallException: SelectorException
81 {
82     /**
83      * Construct a selector exception with the provided text string
84      *
85      * Params:
86      * file     = name of the source file where the exception was thrown; you
87      *            would normally use __FILE__ for this parameter.
88      * line     = line number of the source file where the exception was
89      *            thrown; you would normally use __LINE__ for this parameter.
90      */
91     public this(string file, size_t line)
92     {
93         super("A system call was interrupted by a signal", file, line);
94     }
95 }
96 
97 /**
98  * OutOfMemoryException is thrown when there is not enough memory.
99  */
100 public class OutOfMemoryException: SelectorException
101 {
102     /**
103      * Construct a selector exception with the provided text string
104      *
105      * Params:
106      * file     = name of the source file where the exception was thrown; you
107      *            would normally use __FILE__ for this parameter.
108      * line     = line number of the source file where the exception was
109      *            thrown; you would normally use __LINE__ for this parameter.
110      */
111     public this(string file, size_t line)
112     {
113         super("Out of memory", file, line);
114     }
115 }
116