Dolittle Documentation

DL0008

ExceptionShouldBeSpecific

As with all other code; Exceptions has meaning. You should therefor not be throwing generic exceptions provided by the .NET base class library as these does not have a specific meaning. This rule prevents you from throwing any exception that comes from any System namespace. Your exception should sit side-by-side the code that is throwing it.

Example of good specific exceptions:

  • WriteableImmutableFieldsFound
  • WriteableImmutablePropertiesFound
  • InvalidVersionString
  • UnableToProvideConfigurationObject
  • CannotInvokeMethodBecauseTargetIsNotAlive