References
This page contains references for possible error codes, object structure, etc. Most of this can be obtained from the javadoc/clicking into code via Android Studio, but it is also provided here as a reference.
Errors
When an error occurs, unless otherwise specified it will be a SmartCaptureException
, which is a custom class that extends RuntimeException
.
class SmartCaptureException (
val errorCode: ErrorCode,
message: String? = null,
cause: Throwable? = null
): RuntimeException(message, cause)
The noteworthy part here is the errorCode
which should help guide implementors as to what type of error occurred and how to proceed in their implementations. The following is a reference of the possible error codes:
enum class ErrorCode {
/**
* These should not directly happen. If this does occur then it most likely indicates some
* form of communication error, for example between an activity's finish() and its calling
* method.
*/
Unknown,
/**
* An error to do with the camera. Examples could include a camera failing to open, a camera
* returning a corrupted stream, a camera failing to free data between frames. This error
* generally indicates unusual or damaged hardware or an OS bug.
*/
CameraError,
/**
* An error during camera detection.
*/
DetectionError,
/**
* A permission was not granted at a time when the permission should have been granted. This
* usually indicates a flawed implementation, permissions such as camera or NFC should be
* requested and checked before launching the relevant Compose or Activity.
*/
LackingPermission
}