Committed by
GitHub
Merge pull request #377 from p-mazhnik/pavel/exception
fix: add toString method to MobileScannerException
Showing
1 changed file
with
8 additions
and
0 deletions
| @@ -12,6 +12,14 @@ class MobileScannerException implements Exception { | @@ -12,6 +12,14 @@ class MobileScannerException implements Exception { | ||
| 12 | 12 | ||
| 13 | /// The additional error details that came with the [errorCode]. | 13 | /// The additional error details that came with the [errorCode]. |
| 14 | final MobileScannerErrorDetails? errorDetails; | 14 | final MobileScannerErrorDetails? errorDetails; |
| 15 | + | ||
| 16 | + @override | ||
| 17 | + String toString() { | ||
| 18 | + if (errorDetails != null && errorDetails?.message != null) { | ||
| 19 | + return "MobileScannerException: code ${errorCode.name}, message: ${errorDetails?.message}"; | ||
| 20 | + } | ||
| 21 | + return "MobileScannerException: ${errorCode.name}"; | ||
| 22 | + } | ||
| 15 | } | 23 | } |
| 16 | 24 | ||
| 17 | /// The raw error details for a [MobileScannerException]. | 25 | /// The raw error details for a [MobileScannerException]. |
-
Please register or login to post a comment