Files
printer/lib/models/printer_exception.dart
Developer cae04eead5 init
2026-05-18 17:52:16 +08:00

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';
}