Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. /**
  2. * The exception module defines all system-level exceptions and provides a
  3. * mechanism to alter system-level error handling.
  4. *
  5. * Copyright:
  6. * Copyright (C) 2005-2006 Sean Kelly, Kris Bell.
  7. * Some parts copyright (c) 2009-2016 Sociomantic Labs GmbH.
  8. * All rights reserved.
  9. *
  10. * License:
  11. * Tango Dual License: 3-Clause BSD License / Academic Free License v3.0.
  12. * See LICENSE_TANGO.txt for details.
  13. *
  14. * Authors: Sean Kelly, Kris Bell
  15. *
  16. */
  17. module ocean.core.Exception_tango;
  18.  
  19. import ocean.transition;
  20.  
  21. version = SocketSpecifics; // TODO: remove this before v1.0
  22.  
  23.  
  24. private
  25. {
  26. alias void function( istring file, size_t line, istring msg = null ) assertHandlerType;
  27.  
  28. version(D_Version2)
  29. {
  30. mixin("__gshared assertHandlerType assertHandler = null;");
  31. }
  32. else
  33. {
  34. assertHandlerType assertHandler = null;
  35. }
  36. }
  37.  
  38.  
  39. ////////////////////////////////////////////////////////////////////////////////
  40. /*
  41. - Exception
  42. - OutOfMemoryException
  43. - SwitchException
  44. - AssertException
  45. - ArrayBoundsException
  46. - FinalizeException
  47.  
  48. - PlatformException
  49. - ProcessException
  50. - ThreadException
  51. - FiberException
  52. - ThreadPoolException
  53. - SyncException
  54. - IOException
  55. - SocketException
  56. - VfsException
  57. - ClusterException
  58.  
  59. - NoSuchElementException
  60. - CorruptedIteratorException
  61.  
  62. - IllegalArgumentException
  63. - IllegalElementException
  64.  
  65. - TextException
  66. - XmlException
  67. - RegexException
  68. - LocaleException
  69. - UnicodeException
  70.  
  71. - PayloadException
  72. */
  73. ////////////////////////////////////////////////////////////////////////////////
  74.  
  75.  
  76. public import core.exception;
  77.  
  78. import core.thread;
  79. alias core.thread.ThreadException ThreadException;
  80.  
  81. // Tango backwards compatibility aliases
  82. public alias AssertError AssertException;
  83. public alias OutOfMemoryError OutOfMemoryException;
  84. public alias FinalizeError FinalizeException;
  85. public alias RangeError ArrayBoundsException;
  86. public alias SwitchError SwitchException;
  87.  
  88. /**
  89. * Base class for operating system or library exceptions.
  90. */
  91. class PlatformException : Exception { }
  92.  
  93. /**
  94. * Base class for ThreadPoolException
  95. */
  96. class ThreadPoolException : Exception { }
  97.  
  98.  
  99. /**
  100. * Base class for synchronization exceptions.
  101. */
  102. class SyncException : PlatformException { }
  103.  
  104.  
  105.  
  106. /**
  107. * The basic exception thrown by the ocean.io package. One should try to ensure
  108. * that all Tango exceptions related to IO are derived from this one.
  109. */
  110. class IOException : PlatformException { }
  111.  
  112. /**
  113. * The basic exception thrown by the ocean.io.vfs package.
  114. */
  115. class VfsException : IOException { }
  116.  
  117. /**
  118. * The basic exception thrown by the ocean.io.cluster package.
  119. */
  120. class ClusterException : IOException { }
  121.  
  122. /**
  123. * Base class for socket exceptions.
  124. */
  125. class SocketException : IOException { }
  126.  
  127.  
  128. /**
  129. * Base class for exception thrown by an InternetHost.
  130. */
  131. class HostException : IOException { }
  132.  
  133.  
  134. /**
  135. * Base class for exceptiond thrown by an Address.
  136. */
  137. class AddressException : IOException { }
  138.  
  139.  
  140. /**
  141. * Thrown when a socket failed to accept an incoming connection.
  142. */
  143. class SocketAcceptException : SocketException { }
  144.  
  145. /**
  146. * Thrown on a process error.
  147. */
  148. class ProcessException : PlatformException { }
  149.  
  150.  
  151. /**
  152. * Represents a text processing error.
  153. */
  154. class TextException : Exception { }
  155.  
  156.  
  157. /**
  158. * Base class for regluar expression exceptions.
  159. */
  160. class RegexException : TextException { }
  161.  
  162.  
  163. /**
  164. * Base class for locale exceptions.
  165. */
  166. class LocaleException : TextException { }
  167.  
  168.  
  169. /**
  170. * Base class for XML exceptions.
  171. */
  172. class XmlException : TextException { }
  173.  
  174.  
  175. /**
  176. * RegistryException is thrown when the NetworkRegistry encounters a
  177. * problem during proxy registration, or when it sees an unregistered
  178. * guid.
  179. */
  180. class RegistryException : Exception { }
  181.  
  182.  
  183. /**
  184. * Thrown when an illegal argument is encountered.
  185. */
  186. class IllegalArgumentException : Exception { }
  187.  
  188.  
  189. /**
  190. *
  191. * IllegalElementException is thrown by Collection methods
  192. * that add (or replace) elements (and/or keys) when their
  193. * arguments are null or do not pass screeners.
  194. *
  195. */
  196. class IllegalElementException : IllegalArgumentException { }
  197.  
  198.  
  199. /**
  200. * Thrown on past-the-end errors by iterators and containers.
  201. */
  202. class NoSuchElementException : Exception { }
  203.  
  204.  
  205. /**
  206. * Thrown when a corrupt iterator is detected.
  207. */
  208. class CorruptedIteratorException : NoSuchElementException { }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement