/* Copyright (c) 2003-2006 Niels Kokholm and Peter Sestoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ using System; using System.Diagnostics; using SCG = System.Collections.Generic; namespace C5 { /// /// An exception to throw from library code when an internal inconsistency is encountered. /// public class InternalException : Exception { internal InternalException(string message) : base(message) { } } /// /// An exception thrown by an update operation on a Read-Only collection or dictionary. /// This exception will be thrown unconditionally when an update operation /// (method or set property) is called. No check is made to see if the update operation, /// if allowed, would actually change the collection. /// [Serializable] public class ReadOnlyCollectionException : Exception { /// /// Create a simple exception with no further explanation. /// public ReadOnlyCollectionException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public ReadOnlyCollectionException(string message) : base(message) { } } /// /// /// [Serializable] public class FixedSizeCollectionException : Exception { /// /// Create a simple exception with no further explanation. /// public FixedSizeCollectionException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public FixedSizeCollectionException(string message) : base(message) { } } /// /// /// [Serializable] public class UnlistenableEventException : Exception { /// /// Create a simple exception with no further explanation. /// public UnlistenableEventException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public UnlistenableEventException(string message) : base(message) { } } /// /// An exception thrown by enumerators, range views etc. when accessed after /// the underlying collection has been modified. /// [Serializable] public class CollectionModifiedException : Exception { /// /// Create a simple exception with no further explanation. /// public CollectionModifiedException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public CollectionModifiedException(string message) : base(message) { } } /// /// An excption thrown when trying to access a view (a list view on a or /// a snapshot on a ) /// that has been invalidated by some earlier operation. /// /// The typical scenario is a view on a list that hash been invalidated by a call to /// Sort, Reverse or Shuffle on some other, overlapping view or the whole list. /// /// [Serializable] public class ViewDisposedException : Exception { /// /// Create a simple exception with no further explanation. /// public ViewDisposedException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public ViewDisposedException(string message) : base(message) { } } /// /// An exception thrown by a lookup or lookup with update operation that does not /// find the lookup item and has no other means to communicate failure. /// The typical scenario is a lookup by key in a dictionary with an indexer, /// see e.g. /// [Serializable] public class NoSuchItemException : Exception { /// /// Create a simple exception with no further explanation. /// public NoSuchItemException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public NoSuchItemException(string message) : base(message) { } } /// /// An exception thrown by an operation on a list () /// that only makes sense for a view, not for an underlying list. /// [Serializable] public class NotAViewException : Exception { /// /// Create a simple exception with no further explanation. /// public NotAViewException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public NotAViewException(string message) : base(message) { } } /// /// An exception thrown when an operation attempts to create a duplicate in a collection with set semantics /// ( is false) or attempts to create a duplicate key in a dictionary. /// With collections this can only happen with Insert operations on lists, since the Add operations will /// not try to create duplictes and either ignore the failure or report it in a bool return value. /// /// With dictionaries this can happen with the metod. /// [Serializable] public class DuplicateNotAllowedException : Exception { /// /// Create a simple exception with no further explanation. /// public DuplicateNotAllowedException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public DuplicateNotAllowedException(string message) : base(message) { } } /// /// /// [Serializable] public class InvalidPriorityQueueHandleException : Exception { /// /// Create a simple exception with no further explanation. /// public InvalidPriorityQueueHandleException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public InvalidPriorityQueueHandleException(string message) : base(message) { } } /// /// An exception thrown by an operation that need to construct a natural /// comparer for a type. /// [Serializable] public class NotComparableException : Exception { /// /// Create a simple exception with no further explanation. /// public NotComparableException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public NotComparableException(string message) : base(message) { } } /// /// An exception thrown by operations on a list that expects an argument /// that is a view on the same underlying list. /// [Serializable] public class IncompatibleViewException : Exception { /// /// Create a simple exception with no further explanation. /// public IncompatibleViewException() : base() { } /// /// Create the exception with an explanation of the reason. /// /// public IncompatibleViewException(string message) : base(message) { } } }