Skip to main content

Error codes

Every MobbScanAPI block receives an NSError as its last argument. It is nil when the operation succeeds.

PropertyTypeDescription
codeIntA value of MobbScanAPIErrorCode (see the table below)
userInfo[String: Any]Additional details, when available

Handle an error​

Check the error code to decide what to show the user. The most common cases:

CodeRecommended handling
PROCESS_CANCELLED, SCANNING_PROCESS_CANCELLEDThe user left the capture: return to the previous step
CONNECTION_ERROR, TIMEOUT_ERRORAsk the user to check the connection and retry
PERMISSION_ERRORAsk the user to grant the camera (and microphone) permission in Settings
DOCUMENT_NOT_VALID, DOCUMENT_NOT_CLASSIFIEDAsk for a valid document; read userInfo for the reason
LICENSE_ERROR, API_NOT_INITIALIZEDIntegration issue: check initAPI and the license

When a document does not pass the validations configured for your process, userInfo["extraInfo"] lists the failed validations:

if let error = error as NSError? {
print("Failed validations: \(error.userInfo["extraInfo"] ?? "")")
// Failed validations: validationDocumentNotExpired
}

Their meaning is described in the document object.

Error codes​

CodeMeaning
SCANNING_PROCESS_CANCELLEDThe user cancelled the scanning process
CONNECTION_ERRORA network connection error happened
LICENSE_ERRORThe license is not valid or has not been configured
WRONG_PARAMETERS_ERRORSome of the parameters are not valid
SCAN_PROCESS_NOT_STARTEDThe scan process has not been started
SCAN_ID_DOES_NOT_MATCHThe provided scan id does not match the currently started scan
DEVICE_NOT_COMPATIBLEDevice does not fulfill the minimum requirements
UNEXPECTED_ERRORSomething unexpected happened during the process
API_NOT_INITIALIZEDMobbScanAPI was not properly initialised
CAMERA_NOT_VALID_FOR_VALIDATIONDevice camera does not fulfill the needed specs
NOT_AVAILABLE_IN_OFFLINE_MODEThis method is not available in offline mode
CAPTURE_FACE_ERRORFacial detection could not accomplished
PROCESS_CANCELLEDThe user cancelled any process (document detection, face validation...)
TIMEOUT_ERRORThe process timeout expired
ANTISPOOFING_ERRORThe antispoofing mechanism cannot ensure the user is genuine
DOCUMENT_NOT_CLASSIFIEDThe system is not able to classify the document (only applicable for generic document types, i.e. ESP)
DOCUMENT_NOT_VALIDThe document did not pass the validations (applicable when specific validations are activated)
DOCUMENT_NOT_DETECTEDThe document could not be detected
PERMISSION_ERRORThe user has denied some of the required permissions
UNAUTHORIZED_ERRORThis user is not authorized to perform the requested action
SCAN_PROCESS_ALREADY_STARTED_ERRORThe scan process has already been started
FACE_DOCUMENT_NOT_DETECTED_ERRORNo face was detected in the document