25 lines
707 B
Dart
25 lines
707 B
Dart
/// Custom exception for printer operations.
|
|
///
|
|
/// Encapsulates structured error information from the native layer,
|
|
/// including error code, message, and optional details.
|
|
class PrinterException implements Exception {
|
|
/// Machine-readable error code (e.g., 'INVALID_ARGUMENT', 'PORT_OPEN_FAILED').
|
|
final String code;
|
|
|
|
/// Human-readable error message.
|
|
final String message;
|
|
|
|
/// Additional error details (may be null).
|
|
final dynamic details;
|
|
|
|
/// Creates a [PrinterException] with the given [code] and [message].
|
|
const PrinterException({
|
|
required this.code,
|
|
required this.message,
|
|
this.details,
|
|
});
|
|
|
|
@override
|
|
String toString() => 'PrinterException($code): $message';
|
|
}
|