3 Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft
\r
4 Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 of this software and associated documentation files (the "Software"), to deal
\r
6 in the Software without restriction, including without limitation the rights
\r
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 copies of the Software, and to permit persons to whom the Software is
\r
9 furnished to do so, subject to the following conditions:
\r
11 The above copyright notice and this permission notice shall be included in
\r
12 all copies or substantial portions of the Software.
\r
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
\r
24 using System.Diagnostics;
\r
25 using SCG = System.Collections.Generic;
\r
30 /// An exception to throw from library code when an internal inconsistency is encountered.
\r
32 public class InternalException : Exception
\r
34 internal InternalException(string message) : base(message) { }
\r
38 /// An exception thrown by an update operation on a Read-Only collection or dictionary.
\r
39 /// <para>This exception will be thrown unconditionally when an update operation
\r
40 /// (method or set property) is called. No check is made to see if the update operation,
\r
41 /// if allowed, would actually change the collection. </para>
\r
44 public class ReadOnlyCollectionException : Exception
\r
47 /// Create a simple exception with no further explanation.
\r
49 public ReadOnlyCollectionException() : base() { }
\r
51 /// Create the exception with an explanation of the reason.
\r
53 /// <param name="message"></param>
\r
54 public ReadOnlyCollectionException(string message) : base(message) { }
\r
61 public class FixedSizeCollectionException : Exception
\r
64 /// Create a simple exception with no further explanation.
\r
66 public FixedSizeCollectionException() : base() { }
\r
68 /// Create the exception with an explanation of the reason.
\r
70 /// <param name="message"></param>
\r
71 public FixedSizeCollectionException(string message) : base(message) { }
\r
78 public class UnlistenableEventException : Exception
\r
81 /// Create a simple exception with no further explanation.
\r
83 public UnlistenableEventException() : base() { }
\r
85 /// Create the exception with an explanation of the reason.
\r
87 /// <param name="message"></param>
\r
88 public UnlistenableEventException(string message) : base(message) { }
\r
92 /// An exception thrown by enumerators, range views etc. when accessed after
\r
93 /// the underlying collection has been modified.
\r
96 public class CollectionModifiedException : Exception
\r
99 /// Create a simple exception with no further explanation.
\r
101 public CollectionModifiedException() : base() { }
\r
103 /// Create the exception with an explanation of the reason.
\r
105 /// <param name="message"></param>
\r
106 public CollectionModifiedException(string message) : base(message) { }
\r
110 /// An excption thrown when trying to access a view (a list view on a <see cref="T:C5.IList`1"/> or
\r
111 /// a snapshot on a <see cref="T:C5.IPersistentSorted`1"/>)
\r
112 /// that has been invalidated by some earlier operation.
\r
114 /// The typical scenario is a view on a list that hash been invalidated by a call to
\r
115 /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list.
\r
119 public class ViewDisposedException : Exception
\r
122 /// Create a simple exception with no further explanation.
\r
124 public ViewDisposedException() : base() { }
\r
126 /// Create the exception with an explanation of the reason.
\r
128 /// <param name="message"></param>
\r
129 public ViewDisposedException(string message) : base(message) { }
\r
133 /// An exception thrown by a lookup or lookup with update operation that does not
\r
134 /// find the lookup item and has no other means to communicate failure.
\r
135 /// <para>The typical scenario is a lookup by key in a dictionary with an indexer,
\r
136 /// see e.g. <see cref="P:C5.IDictionary`2.Item(`0)"/></para>
\r
139 public class NoSuchItemException : Exception
\r
142 /// Create a simple exception with no further explanation.
\r
144 public NoSuchItemException() : base() { }
\r
146 /// Create the exception with an explanation of the reason.
\r
148 /// <param name="message"></param>
\r
149 public NoSuchItemException(string message) : base(message) { }
\r
153 /// An exception thrown by an operation on a list (<see cref="T:C5.IList`1"/>)
\r
154 /// that only makes sense for a view, not for an underlying list.
\r
157 public class NotAViewException : Exception
\r
160 /// Create a simple exception with no further explanation.
\r
162 public NotAViewException() : base() { }
\r
164 /// Create the exception with an explanation of the reason.
\r
166 /// <param name="message"></param>
\r
167 public NotAViewException(string message) : base(message) { }
\r
171 /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics
\r
172 /// (<see cref="P:C5.IExtensible`1.AllowsDuplicates"/> is false) or attempts to create a duplicate key in a dictionary.
\r
173 /// <para>With collections this can only happen with Insert operations on lists, since the Add operations will
\r
174 /// not try to create duplictes and either ignore the failure or report it in a bool return value.
\r
176 /// <para>With dictionaries this can happen with the <see cref="M:C5.IDictionary`2.Add(`0,`1)"/> metod.</para>
\r
179 public class DuplicateNotAllowedException : Exception
\r
182 /// Create a simple exception with no further explanation.
\r
184 public DuplicateNotAllowedException() : base() { }
\r
186 /// Create the exception with an explanation of the reason.
\r
188 /// <param name="message"></param>
\r
189 public DuplicateNotAllowedException(string message) : base(message) { }
\r
196 public class InvalidPriorityQueueHandleException : Exception
\r
199 /// Create a simple exception with no further explanation.
\r
201 public InvalidPriorityQueueHandleException() : base() { }
\r
203 /// Create the exception with an explanation of the reason.
\r
205 /// <param name="message"></param>
\r
206 public InvalidPriorityQueueHandleException(string message) : base(message) { }
\r
210 /// An exception thrown by an operation that need to construct a natural
\r
211 /// comparer for a type.
\r
214 public class NotComparableException : Exception
\r
217 /// Create a simple exception with no further explanation.
\r
219 public NotComparableException() : base() { }
\r
221 /// Create the exception with an explanation of the reason.
\r
223 /// <param name="message"></param>
\r
224 public NotComparableException(string message) : base(message) { }
\r
228 /// An exception thrown by operations on a list that expects an argument
\r
229 /// that is a view on the same underlying list.
\r
232 public class IncompatibleViewException : Exception
\r
235 /// Create a simple exception with no further explanation.
\r
237 public IncompatibleViewException() : base() { }
\r
239 /// Create the exception with an explanation of the reason.
\r
241 /// <param name="message"></param>
\r
242 public IncompatibleViewException(string message) : base(message) { }
\r