Skip to content

Latest commit

 

History

History
33 lines (17 loc) · 911 Bytes

handling-errors.md

File metadata and controls

33 lines (17 loc) · 911 Bytes

Handling Errors

How to Handle Errors

When a biometric flow fails, it can be due to a number of reasons outside an exit form. Those errors appear for the user in the form of coloured screens. So when handling the result from a flow and an error occurs, you can get access to what type of error occurred using the Constants class.

Extracting the error:

import com.simprints.libsimprints.Constants;

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

super.onActivityResult(requestCode, resultCode, data)

// ensure that the result status is OK

if (resultCode != Activity.RESULT_OK) {

//...code to extract the error that occurred

// using the Constants class

// for instance, an error due to invalid project id

boolean isProjectIdError = resultCode == Constants.SIMPRINTS_INVALID_PROJECT_ID

} else {

//...code to handle success case

}

}