seiti.eti.br

programming & gadgets


by seiti tt seiti

Uma lista de exceções úteis para utilizar em seu sistema, sem ter que criar sempre outra classe e escrever mais código.

Ultimamente tenho pensado numa programação Zen: o melhor código é o não-código. Quanto menos código você escrever, menos terá para manter, menos terá para entender, menos terá para depurar. Ou talvez esteja exacerbando apenas a melhor qualidade de um programador.

Chega de papo-furado, segue a lista (todas no namespace System):

ApplicationException The exception that is thrown when a non-fatal application error occurs.
ArgumentException The exception that is thrown when one of the arguments provided to a method is not valid.
ArgumentNullException The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
ArgumentOutOfRangeException The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
ArithmeticException The exception that is thrown for errors in an arithmetic, casting, or conversion operation.
ArrayTypeMismatchException The exception that is thrown when an attempt is made to store an element of the wrong type within an array.
FieldAccessException The exception that is thrown when there is an invalid attempt to access a private or protected field inside a class.
FormatException The exception that is thrown when the format of an argument does not meet the parameter specifications of the invoked method.
IndexOutOfRangeException The exception that is thrown when an attempt is made to access an element of an array with an index that is outside the bounds of the array. This class cannot be inherited.
InvalidOperationException The exception that is thrown when a method call is invalid for the object’s current state.
NotFiniteNumberException The exception that is thrown when a floating-point value is positive infinity, negative infinity, or Not-a-Number (NaN).
NotImplementedException The exception that is thrown when a requested method or operation is not implemented.
NotSupportedException The exception that is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.
NullReferenceException The exception that is thrown when there is an attempt to dereference a null object reference.
ObjectDisposedException The exception that is thrown when an operation is performed on a disposed object.
PlatformNotSupportedException The exception that is thrown when a feature does not run on a particular platform.
RankException The exception that is thrown when an array with the wrong number of dimensions is passed to a method.
SystemException Defines the base class for predefined exceptions in the namespace.
TimeoutException The exception that is thrown when the time allotted for a process or operation has expired.
TypeInitializationException The exception that is thrown as a wrapper around the exception thrown by the class initializer. This class cannot be inherited.
UnauthorizedAccessException The exception that is thrown when the operating system denies access because of an I/O error or a specific type of security error.

Fonte: http://mikevallotton.wordpress.com/2009/07/08/net-exceptions-all-of-them/