MessagePackException class sealed
Base class for all exceptions thrown by the MessagePack library.
This is a sealed class, meaning you can exhaustively catch all its
subclasses in a switch statement to handle different error scenarios
gracefully.
Example:
try {
final data = deserialize(bytes);
} on MessagePackException catch (e) {
switch (e) {
case MessagePackFormatException():
print('Data is corrupted: ${e.message}');
case MessagePackUnsupportedTypeException():
print('Tried to encode unknown type: ${e.unsupportedType}');
case MessagePackSizeException():
print('Payload too large: ${e.message}');
case MessagePackConfigurationException():
print('Extension config error: ${e.message}');
}
}
- Implemented types
- Implementers
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The description of what went wrong.
final
- name → String
-
The name of the exception, used in toString.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- suggestion → String?
-
An optional actionable suggestion on how to fix the error.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited