Common Exception Types

During my recently FrontLine trip I gave a talk on exception handling… One of the points I made is that if possible you should leverage one of the existing exception types in the BCL. I was asked a couple of times what the common exception types area. Typically I used it to plug the BCL poster, but I wanted to give you an online version of the data as well.

Next time you go to create a new exception, check here first. Use or subclass one of these if possible.

+--System.Object

   |

   |

   +--System.Exception

       |

       |

   +--System.SystemException

           |

           |

           +--System.ArgumentException

           | |

           | |

           | +--System.ArgumentNullException

           | |

           | |

           | +--System.ArgumentOutOfRangeException

           | |

           | |

           | +--System.DuplicateWaitObjectException

           |

           |

           +--System.ArithmeticException

           | |

           | |

           | +--System.DivideByZeroException

           | |

           | |

           | +--System.OverflowException

           | |

           | |

           | +--System.NotFiniteNumberException

           |

           |

           +--System.ArrayTypeMismatchException

           |

           |

           +--System.ExecutionEngineException

           |

           |

           +--System.FormatException

           |

           |

           +--System.IndexOutOfRangeException

           |

          |

           +--System.InvalidCastException

           |

           |

           +--System.InvalidOperationException

           | |

           | |

           | +--System.ObjectDisposedException

           |

           |

           +--System.InvalidProgramException

           |

           |

           +--System.IO.IOException

           | |

           | |

           | +--System.IO.DirectoryNotFoundException

           | |

           | |

           | +--System.IO.EndOfStreamException

           | |

           | |

           | +--System.IO.FileLoadException

           | |

           | |

           | +--System.IO.FileNotFoundException

           | |

           | |

           | +--System.IO.PathTooLongException

           |

           |

           +--System.NotImplementedException

           |

           |

           +--System.NotSupportedException

           |

           |

           +--System.NullReferenceException

           |

   |

           +--System.OutOfMemoryException

           |

           |

           +--System.RankException

           |

           |

           +--System.Security.SecurityException

           |

           |

           +--System.Security.VerificationException

           |

           |

           +--System.StackOverflowException

           |

           |

           +--System.Threading.SynchronizationLockException

           |

           |

           +--System.Threading.ThreadAbortException

           |

           |

           +--System.Threading.ThreadStateException

           |

           |

           +--System.TypeInitializationException

           |

           |

           +--System.UnauthorizedAccessException