Handling Failures
Reference for React Native Face Liveness failure handling. Learn CerttaLivenessFailure types, cause values, and how to map failures to clear user guidance.
When a liveness check fails, useCafFaceLiveness updates event.failed with a CerttaLivenessFailure object. This object contains a cause parameter (a stable code for mapping logic) and, for recognition failures, a description field with user-facing text.
Understanding and handling these fields is critical for providing clear, actionable feedback so users can correct the issue and try again.
The failure models
Both capture-level and recognition-level failures share the same CerttaLivenessFailure type. Use type to distinguish them:
type
Meaning
CerttaLivenessFailureType.ImageCaptureFailure
Image capture failed. No signed image (response) is available.
CerttaLivenessFailureType.FaceRecognitionFailure
Capture succeeded, but recognition or authentication failed. response holds the signed payload. description provides a human-readable message.
For FaceRecognitionFailure, cause is normalized to uppercase by the React Native plugin. Use cause for conditional logic and description (or your own localized copy) for messages shown to end users.
Using cause and description
The cause parameter returns a stable constant string (for example "TOO_DARK" or "FACE_TOO_FAR"). Do not display cause directly to end users.
For FaceRecognitionFailure, prefer description as a fallback when you do not maintain a custom mapping. Otherwise, map cause to a localized, user-friendly message in your UI.
Available failure causes
UNKNOWN
Generic failure
TOO_MUCH_MOVEMENT
Excessive head motion
TOO_BRIGHT
Over-illumination
TOO_DARK
Low light conditions
MISALIGNED_FACE
Face alignment failure
FACE_TOO_FAR
Face too distant
FACE_TOO_CLOSE
Face too close
SUNGLASSES
Eye-obscuring eyewear
OBSCURED_FACE
Partial face obstruction
EYES_CLOSED
Closed eyes during capture
MULTIPLE_FACES
Multiple faces detected
BACKGROUND_ISSUE
Unsuitable background
DEVICE_ISSUE
Incompatible device
EYEWEAR
Eyewear detected
FACE_NOT_FOUND
Face detection failure
FRAMES_BLURRY
Blurry frames detected
MOTION_ISSUE
Device motion error
LIGHTING_ISSUES
Poor lighting conditions
REJECTED
Transaction rejected
SYSTEM_ERROR
Internal system error
TIMEOUT
Session timeout
USER_NOT_FOUND
User lookup failure
DEVICE_RESTART
Device state error
PROCESSING_FAULT
Processing error
Treat unknown values as a generic retry message.
Example implementation
Atualizado

