NamedException.create constructor

NamedException.create(
  1. String problem, {
  2. String name = 'UnnamedException',
  3. String solution = '<none>',
  4. ExceptionSeverity severity = ExceptionSeverity.none,
})

Example:

final exception = NamedException.create('Provided value is -26 which is negative.');

or

final exception = NamedException.create(
  'Provided value is -26 which is negative.'
  solution: 'Please provide a positive value.'
  severity: ExceptionSeverity.critical,
);

Implementation

factory NamedException.create(
  String problem, {
  String name = 'UnnamedException',
  String solution = '<none>',
  ExceptionSeverity severity = ExceptionSeverity.none,
}) =>
    BasicException(
      problem,
      name: name,
      solution: solution,
      severity: severity,
    );