Error handling
Overview
As you might have read along these documents, most of the MobbScanAPI callbacks have an error as their last argument.
This is the way MobbScan let you know the reason why a process did not end successfully.
The possible error comes with the general structure as follows:
{
"errorCode": "WRONG_PARAMETERS_ERROR",
"errorDetails": "Some of the parameters are not valid"
}
where:
errorCode: is astringand represents the specific code identifying the error.errorDetails: is astringand provides additional information or context about the error.
Error Codes
The following table shows the possible error codes and their meaning:
| Code | Meaning | Method |
|---|---|---|
CONNECTION_ERROR | A network connection error happened. | startScan |
DOCUMENT_NOT_CLASSIFIED | The system is unable to classify the document. | scanDocument |
SCAN_PROCESS_ALREADY_STARTED_ERROR | The scan process identifier (scanId) has been previously used. | startScan |
UNAUTHORIZED_ERROR | Wrong scanId, previously used or expired token. | startScan, scanDocument, validateFace |
USER_CANCELLED_ERROR | Back button pressed during face scanning. | scanDocument, validateFace |
VALIDATION_ERROR | The validation criteria were not met (see below). | scanDocument, validateFace |
WRONG_PARAMETERS_ERROR | Wrong token or no scanId provided. | startScan |
Validation Errors
Another type of error may occur, with a structure similar to the previous ones, when one or more validations fail in the scanDocument or validateFace methods. In this case, the error will also include the details of the failed validations, as shown in the examples below.
{
"errorCode": "VALIDATION_ERROR",
"errorDetails": "Some of the validation criteria have failed.",
"failedValidations": ["validationDocumentNotExpired", "validationDocumentNotSpecimen"]
}
{
"errorCode": "VALIDATION_ERROR",
"errorDetails": "Some of the validation criteria have failed.",
"failedValidations": ["validationLiveness", "validationIdentityVerification"]
}
where:
failedValidations: is anarrayofstringslisting the validations that failed.
