Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-09-18 11:59:53 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ece227d77e7253a62ec03266d80fbf08de7e0ab0
ece227d7
1 parent
0b8b5327
add MobileScannerBarcodeException & fix error to string implementation
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
lib/src/mobile_scanner_exception.dart
lib/src/mobile_scanner_exception.dart
View file @
ece227d
import
'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'
;
/// This class represents an exception thrown by the
mobile scanner
.
/// This class represents an exception thrown by the
[MobileScannerController]
.
class
MobileScannerException
implements
Exception
{
const
MobileScannerException
({
required
this
.
errorCode
,
...
...
@@ -16,9 +16,9 @@ class MobileScannerException implements Exception {
@override
String
toString
()
{
if
(
errorDetails
!=
null
&&
errorDetails
?.
message
!=
null
)
{
return
"MobileScannerException: code
${errorCode.name}
, message:
${errorDetails?.message}
"
;
return
'MobileScannerException(
${errorCode.name}
,
${errorDetails?.message}
)'
;
}
return
"MobileScannerException:
${errorCode.name}
"
;
return
'MobileScannerException(
${errorCode.name}
)'
;
}
}
...
...
@@ -46,3 +46,22 @@ class MobileScannerErrorDetails {
/// This exception type is only used internally,
/// and is not part of the public API.
class
PermissionRequestPendingException
implements
Exception
{}
/// This class represents an exception thrown by the [MobileScannerController]
/// when a barcode scanning error occurs when processing an input frame.
class
MobileScannerBarcodeException
implements
Exception
{
/// Creates a new [MobileScannerBarcodeException] with the given error message.
const
MobileScannerBarcodeException
(
this
.
message
);
/// The error message of the exception.
final
String
?
message
;
@override
String
toString
()
{
if
(
message
?.
isNotEmpty
??
false
)
{
return
'MobileScannerBarcodeException(
$message
)'
;
}
return
'MobileScannerBarcodeException(Could not detect a barcode in the input image.)'
;
}
}
...
...
Please
register
or
login
to post a comment