1 /** 2 * The exception module defines all system-level exceptions and provides a 3 * mechanism to alter system-level error handling. 4 * 5 * Copyright: Copyright (C) 2005-2006 Sean Kelly, Kris Bell. All rights reserved. 6 * License: BSD style: $(LICENSE) 7 * Authors: Sean Kelly, Kris Bell 8 */ 9 module tango.core.Exception; 10 11 public import core.exception; 12 13 version = SocketSpecifics; // TODO: remove this before v1.0 14 15 //////////////////////////////////////////////////////////////////////////////// 16 /* 17 - Exception 18 - OutOfMemoryException 19 - SwitchException 20 - AssertException 21 - ArrayBoundsException 22 - FinalizeException 23 24 - PlatformException 25 - ProcessException 26 - ThreadException 27 - FiberException 28 - ThreadPoolException 29 - SyncException 30 - IOException 31 - SocketException 32 - VfsException 33 - ClusterException 34 35 - NoSuchElementException 36 - CorruptedIteratorException 37 38 - IllegalArgumentException 39 - IllegalElementException 40 41 - TextException 42 - XmlException 43 - RegexException 44 - LocaleException 45 - UnicodeException 46 47 - PayloadException 48 */ 49 //////////////////////////////////////////////////////////////////////////////// 50 51 52 /** 53 * Base class for operating system or library exceptions. 54 */ 55 class PlatformException : Exception 56 { 57 this( immutable(char)[] msg ) 58 { 59 super( msg ); 60 } 61 } 62 63 /** 64 * Represents a text processing error. 65 */ 66 class TextException : Exception 67 { 68 this( immutable(char)[] msg ) 69 { 70 super( msg ); 71 } 72 } 73 74 /** 75 * Base class for ThreadPoolException 76 */ 77 class ThreadPoolException : Exception 78 { 79 this( immutable(char)[] msg ) 80 { 81 super( msg ); 82 } 83 } 84 85 86 /** 87 * Base class for synchronization exceptions. 88 */ 89 class SyncException : PlatformException 90 { 91 this( immutable(char)[] msg ) 92 { 93 super( msg ); 94 } 95 } 96 97 /** 98 * The basic exception thrown by the tango.io package. One should try to ensure 99 * that all Tango exceptions related to IO are derived from this one. 100 */ 101 class IOException : PlatformException 102 { 103 this( immutable(char)[] msg ) 104 { 105 super( msg ); 106 } 107 } 108 109 /** 110 * The basic exception thrown by the tango.io.vfs package. 111 */ 112 class VfsException : IOException 113 { 114 this( immutable(char)[] msg ) 115 { 116 super( msg ); 117 } 118 } 119 120 /** 121 * The basic exception thrown by the tango.io.cluster package. 122 */ 123 class ClusterException : IOException 124 { 125 this( immutable(char)[] msg ) 126 { 127 super( msg ); 128 } 129 } 130 131 /** 132 * Base class for socket exceptions. 133 */ 134 class SocketException : IOException 135 { 136 this( immutable(char)[] msg ) 137 { 138 super( msg ); 139 } 140 } 141 142 143 version (SocketSpecifics) 144 { 145 /** 146 * Base class for exception thrown by an InternetHost. 147 */ 148 class HostException : IOException 149 { 150 this( immutable(char)[] msg ) 151 { 152 super( msg ); 153 } 154 } 155 156 157 /** 158 * Base class for exceptiond thrown by an Address. 159 */ 160 class AddressException : IOException 161 { 162 this( immutable(char)[] msg ) 163 { 164 super( msg ); 165 } 166 } 167 168 169 /** 170 * Thrown when a socket failed to accept an incoming connection. 171 */ 172 class SocketAcceptException : SocketException 173 { 174 this( immutable(char)[] msg ) 175 { 176 super( msg ); 177 } 178 } 179 } 180 181 /** 182 * Thrown on a process error. 183 */ 184 class ProcessException : PlatformException 185 { 186 this( immutable(char)[] msg ) 187 { 188 super( msg ); 189 } 190 } 191 192 193 /** 194 * Base class for regluar expression exceptions. 195 */ 196 class RegexException : TextException 197 { 198 this( immutable(char)[] msg ) 199 { 200 super( msg ); 201 } 202 } 203 204 205 /** 206 * Base class for locale exceptions. 207 */ 208 class LocaleException : TextException 209 { 210 this( immutable(char)[] msg ) 211 { 212 super( msg ); 213 } 214 } 215 216 217 /** 218 * Base class for XML exceptions. 219 */ 220 class XmlException : TextException 221 { 222 this( immutable(char)[] msg ) 223 { 224 super( msg ); 225 } 226 } 227 228 229 /** 230 * RegistryException is thrown when the NetworkRegistry encounters a 231 * problem during proxy registration, or when it sees an unregistered 232 * guid. 233 */ 234 class RegistryException : Exception 235 { 236 this( immutable(char)[] msg ) 237 { 238 super( msg ); 239 } 240 } 241 242 243 /** 244 * Thrown when an illegal argument is encountered. 245 */ 246 class IllegalArgumentException : Exception 247 { 248 this( immutable(char)[] msg ) 249 { 250 super( msg ); 251 } 252 } 253 254 255 /** 256 * 257 * IllegalElementException is thrown by Collection methods 258 * that add (or replace) elements (and/or keys) when their 259 * arguments are null or do not pass screeners. 260 * 261 */ 262 class IllegalElementException : IllegalArgumentException 263 { 264 this( immutable(char)[] msg ) 265 { 266 super( msg ); 267 } 268 } 269 270 271 /** 272 * Thrown on past-the-end errors by iterators and containers. 273 */ 274 class NoSuchElementException : Exception 275 { 276 this( immutable(char)[] msg ) 277 { 278 super( msg ); 279 } 280 } 281 282 283 /** 284 * Thrown when a corrupt iterator is detected. 285 */ 286 class CorruptedIteratorException : NoSuchElementException 287 { 288 this( immutable(char)[] msg ) 289 { 290 super( msg ); 291 } 292 } 293