Showing
1 changed file
with
25 additions
and
1 deletions
| @@ -2,8 +2,32 @@ import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'; | @@ -2,8 +2,32 @@ import 'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'; | ||
| 2 | 2 | ||
| 3 | /// This class represents an exception throzn by the mobile scanner. | 3 | /// This class represents an exception throzn by the mobile scanner. |
| 4 | class MobileScannerException implements Exception { | 4 | class MobileScannerException implements Exception { |
| 5 | - MobileScannerException({required this.errorCode}); | 5 | + const MobileScannerException({ |
| 6 | + required this.errorCode, | ||
| 7 | + this.errorDetails, | ||
| 8 | + }); | ||
| 6 | 9 | ||
| 7 | /// The error code of the exception. | 10 | /// The error code of the exception. |
| 8 | final MobileScannerErrorCode errorCode; | 11 | final MobileScannerErrorCode errorCode; |
| 12 | + | ||
| 13 | + /// The additional error details that came with the [errorCode]. | ||
| 14 | + final MobileScannerErrorDetails? errorDetails; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +/// The raw error details for a [MobileScannerException]. | ||
| 18 | +class MobileScannerErrorDetails { | ||
| 19 | + const MobileScannerErrorDetails({ | ||
| 20 | + this.code, | ||
| 21 | + this.details, | ||
| 22 | + this.message, | ||
| 23 | + }); | ||
| 24 | + | ||
| 25 | + /// The error code from the [PlatformException]. | ||
| 26 | + final String? code; | ||
| 27 | + | ||
| 28 | + /// The details from the [PlatformException]. | ||
| 29 | + final Object? details; | ||
| 30 | + | ||
| 31 | + /// The error message from the [PlatformException]. | ||
| 32 | + final String? message; | ||
| 9 | } | 33 | } |
-
Please register or login to post a comment