-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1180 from navaronbracke/error_codes_cleanup
fix: Clean up error codes
- Loading branch information
Showing
14 changed files
with
152 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
android/src/main/kotlin/dev/steenbakker/mobile_scanner/objects/MobileScannerErrorCodes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package dev.steenbakker.mobile_scanner.objects | ||
|
||
class MobileScannerErrorCodes { | ||
companion object { | ||
const val ALREADY_STARTED_ERROR = "MOBILE_SCANNER_ALREADY_STARTED_ERROR" | ||
const val ALREADY_STARTED_ERROR_MESSAGE = "The scanner was already started." | ||
// The error code 'BARCODE_ERROR' does not have an error message, | ||
// because it uses the error message from the underlying error. | ||
const val BARCODE_ERROR = "MOBILE_SCANNER_BARCODE_ERROR" | ||
// The error code 'CAMERA_ACCESS_DENIED' does not have an error message, | ||
// because it is used for a boolean result. | ||
const val CAMERA_ACCESS_DENIED = "MOBILE_SCANNER_CAMERA_PERMISSION_DENIED" | ||
const val CAMERA_ERROR = "MOBILE_SCANNER_CAMERA_ERROR" | ||
const val CAMERA_ERROR_MESSAGE = "An error occurred when opening the camera." | ||
const val CAMERA_PERMISSIONS_REQUEST_ONGOING = "MOBILE_SCANNER_CAMERA_PERMISSION_REQUEST_PENDING" | ||
const val CAMERA_PERMISSIONS_REQUEST_ONGOING_MESSAGE = "Another request is ongoing and multiple requests cannot be handled at once." | ||
const val GENERIC_ERROR = "MOBILE_SCANNER_GENERIC_ERROR" | ||
const val GENERIC_ERROR_MESSAGE = "An unknown error occurred." | ||
const val INVALID_ZOOM_SCALE_ERROR_MESSAGE = "The zoom scale should be between 0 and 1 (both inclusive)" | ||
const val NO_CAMERA_ERROR = "MOBILE_SCANNER_NO_CAMERA_ERROR" | ||
const val NO_CAMERA_ERROR_MESSAGE = "No cameras available." | ||
const val SET_SCALE_WHEN_STOPPED_ERROR = "MOBILE_SCANNER_SET_SCALE_WHEN_STOPPED_ERROR" | ||
const val SET_SCALE_WHEN_STOPPED_ERROR_MESSAGE = "The zoom scale cannot be changed when the camera is stopped." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// MobileScannerErrorCodes.swift | ||
// mobile_scanner | ||
// | ||
// Created by Navaron Bracke on 28/05/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
/// This struct defines the error codes and error messages for MobileScanner errors. | ||
/// | ||
/// These are used by `FlutterError` as error code and error message. | ||
/// | ||
/// This struct should not be confused with `MobileScannerError`, | ||
/// which is an implementation detail for the iOS implementation. | ||
struct MobileScannerErrorCodes { | ||
static let ALREADY_STARTED_ERROR = "MOBILE_SCANNER_ALREADY_STARTED_ERROR" | ||
static let ALREADY_STARTED_ERROR_MESSAGE = "The scanner was already started." | ||
// The error code 'BARCODE_ERROR' does not have an error message, | ||
// because it uses the error message from the undelying error. | ||
static let BARCODE_ERROR = "MOBILE_SCANNER_BARCODE_ERROR" | ||
// The error code 'CAMERA_ERROR' does not have an error message, | ||
// because it uses the error message from the underlying error. | ||
static let CAMERA_ERROR = "MOBILE_SCANNER_CAMERA_ERROR" | ||
static let GENERIC_ERROR = "MOBILE_SCANNER_GENERIC_ERROR" | ||
static let GENERIC_ERROR_MESSAGE = "An unknown error occurred." | ||
// This message is used with the 'GENERIC_ERROR' error code. | ||
static let INVALID_ZOOM_SCALE_ERROR_MESSAGE = "The zoom scale should be between 0 and 1 (both inclusive)" | ||
static let NO_CAMERA_ERROR = "MOBILE_SCANNER_NO_CAMERA_ERROR" | ||
static let NO_CAMERA_ERROR_MESSAGE = "No cameras available." | ||
static let SET_SCALE_WHEN_STOPPED_ERROR = "MOBILE_SCANNER_SET_SCALE_WHEN_STOPPED_ERROR" | ||
static let SET_SCALE_WHEN_STOPPED_ERROR_MESSAGE = "The zoom scale cannot be changed when the camera is stopped." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
macos/mobile_scanner/Sources/mobile_scanner/MobileScannerErrorCodes.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// MobileScannerErrorCodes.swift | ||
// mobile_scanner | ||
// | ||
// Created by Navaron Bracke on 27/05/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
struct MobileScannerErrorCodes { | ||
static let ALREADY_STARTED_ERROR = "MOBILE_SCANNER_ALREADY_STARTED_ERROR" | ||
static let ALREADY_STARTED_ERROR_MESSAGE = "The scanner was already started." | ||
// The error code 'BARCODE_ERROR' does not have an error message, | ||
// because it uses the error message from the undelying error. | ||
static let BARCODE_ERROR = "MOBILE_SCANNER_BARCODE_ERROR" | ||
// The error code 'CAMERA_ERROR' does not have an error message, | ||
// because it uses the error message from the underlying error. | ||
static let CAMERA_ERROR = "MOBILE_SCANNER_CAMERA_ERROR" | ||
static let NO_CAMERA_ERROR = "MOBILE_SCANNER_NO_CAMERA_ERROR" | ||
static let NO_CAMERA_ERROR_MESSAGE = "No cameras available." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters