2 Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft
3 Permission is hereby granted, free of charge, to any person obtaining a copy
4 of this software and associated documentation files (the "Software"), to deal
5 in the Software without restriction, including without limitation the rights
6 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 copies of the Software, and to permit persons to whom the Software is
8 furnished to do so, subject to the following conditions:
10 The above copyright notice and this permission notice shall be included in
11 all copies or substantial portions of the Software.
13 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 using System
.Diagnostics
;
24 using SCG
= System
.Collections
.Generic
;
29 /// An exception to throw from library code when an internal inconsistency is encountered.
31 public class InternalException
: Exception
33 internal InternalException(string message
) : base(message
) { }
37 /// An exception thrown by an update operation on a Read-Only collection or dictionary.
38 /// <para>This exception will be thrown unconditionally when an update operation
39 /// (method or set property) is called. No check is made to see if the update operation,
40 /// if allowed, would actually change the collection. </para>
43 public class ReadOnlyCollectionException
: Exception
46 /// Create a simple exception with no further explanation.
48 public ReadOnlyCollectionException() : base() { }
50 /// Create the exception with an explanation of the reason.
52 /// <param name="message"></param>
53 public ReadOnlyCollectionException(string message
) : base(message
) { }
60 public class FixedSizeCollectionException
: Exception
63 /// Create a simple exception with no further explanation.
65 public FixedSizeCollectionException() : base() { }
67 /// Create the exception with an explanation of the reason.
69 /// <param name="message"></param>
70 public FixedSizeCollectionException(string message
) : base(message
) { }
77 public class UnlistenableEventException
: Exception
80 /// Create a simple exception with no further explanation.
82 public UnlistenableEventException() : base() { }
84 /// Create the exception with an explanation of the reason.
86 /// <param name="message"></param>
87 public UnlistenableEventException(string message
) : base(message
) { }
91 /// An exception thrown by enumerators, range views etc. when accessed after
92 /// the underlying collection has been modified.
95 public class CollectionModifiedException
: Exception
98 /// Create a simple exception with no further explanation.
100 public CollectionModifiedException() : base() { }
102 /// Create the exception with an explanation of the reason.
104 /// <param name="message"></param>
105 public CollectionModifiedException(string message
) : base(message
) { }
109 /// An excption thrown when trying to access a view (a list view on a <see cref="T:C5.IList`1"/> or
110 /// a snapshot on a <see cref="T:C5.IPersistentSorted`1"/>)
111 /// that has been invalidated by some earlier operation.
113 /// The typical scenario is a view on a list that hash been invalidated by a call to
114 /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list.
118 public class ViewDisposedException
: Exception
121 /// Create a simple exception with no further explanation.
123 public ViewDisposedException() : base() { }
125 /// Create the exception with an explanation of the reason.
127 /// <param name="message"></param>
128 public ViewDisposedException(string message
) : base(message
) { }
132 /// An exception thrown by a lookup or lookup with update operation that does not
133 /// find the lookup item and has no other means to communicate failure.
134 /// <para>The typical scenario is a lookup by key in a dictionary with an indexer,
135 /// see e.g. <see cref="P:C5.IDictionary`2.Item(`0)"/></para>
138 public class NoSuchItemException
: Exception
141 /// Create a simple exception with no further explanation.
143 public NoSuchItemException() : base() { }
145 /// Create the exception with an explanation of the reason.
147 /// <param name="message"></param>
148 public NoSuchItemException(string message
) : base(message
) { }
152 /// An exception thrown by an operation on a list (<see cref="T:C5.IList`1"/>)
153 /// that only makes sense for a view, not for an underlying list.
156 public class NotAViewException
: Exception
159 /// Create a simple exception with no further explanation.
161 public NotAViewException() : base() { }
163 /// Create the exception with an explanation of the reason.
165 /// <param name="message"></param>
166 public NotAViewException(string message
) : base(message
) { }
170 /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics
171 /// (<see cref="P:C5.IExtensible`1.AllowsDuplicates"/> is false) or attempts to create a duplicate key in a dictionary.
172 /// <para>With collections this can only happen with Insert operations on lists, since the Add operations will
173 /// not try to create duplictes and either ignore the failure or report it in a bool return value.
175 /// <para>With dictionaries this can happen with the <see cref="M:C5.IDictionary`2.Add(`0,`1)"/> metod.</para>
178 public class DuplicateNotAllowedException
: Exception
181 /// Create a simple exception with no further explanation.
183 public DuplicateNotAllowedException() : base() { }
185 /// Create the exception with an explanation of the reason.
187 /// <param name="message"></param>
188 public DuplicateNotAllowedException(string message
) : base(message
) { }
195 public class InvalidPriorityQueueHandleException
: Exception
198 /// Create a simple exception with no further explanation.
200 public InvalidPriorityQueueHandleException() : base() { }
202 /// Create the exception with an explanation of the reason.
204 /// <param name="message"></param>
205 public InvalidPriorityQueueHandleException(string message
) : base(message
) { }
209 /// An exception thrown by an operation that need to construct a natural
210 /// comparer for a type.
213 public class NotComparableException
: Exception
216 /// Create a simple exception with no further explanation.
218 public NotComparableException() : base() { }
220 /// Create the exception with an explanation of the reason.
222 /// <param name="message"></param>
223 public NotComparableException(string message
) : base(message
) { }
227 /// An exception thrown by operations on a list that expects an argument
228 /// that is a view on the same underlying list.
231 public class IncompatibleViewException
: Exception
234 /// Create a simple exception with no further explanation.
236 public IncompatibleViewException() : base() { }
238 /// Create the exception with an explanation of the reason.
240 /// <param name="message"></param>
241 public IncompatibleViewException(string message
) : base(message
) { }