NamedException class abstract
Wrapper around the built-in Exception class.
Provides more classified details of the exception like severity.
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,
);
- Implemented types
- Implementers
Constructors
- NamedException()
-
Empty default constructor for sub classes.
const
- NamedException.create(String problem, {String name = 'UnnamedException', String solution = '<none>', ExceptionSeverity severity = ExceptionSeverity.none})
-
Example:
factory
- NamedException.empty()
-
Example:
factory
- NamedException.fromRaw(Exception exception, StackTrace stackTrace)
-
Converts an unhandled Exception into an UnknownException.
factory
Properties
- category → Type
-
category is either the super class or this class.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → String
-
An identifer for the exception.
Default to the class's runtimeType.
no setteroverride
- name → String
-
A more user readable exception name than the key.
Default to key unless otherwise specified.
no setter
- problem → String
-
Problem statement of the Exception.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- severity → ExceptionSeverity
-
Severity can be none, warning or critical.
no setter
- solution → String
-
Solution statement of the Exception.
no setter
- text → String
-
Complete description of the Exception.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
toString function returns the exception's text.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited