init
This commit is contained in:
24
lib/models/printer_exception.dart
Normal file
24
lib/models/printer_exception.dart
Normal file
@@ -0,0 +1,24 @@
|
||||
/// 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';
|
||||
}
|
||||
Reference in New Issue
Block a user