Class NativeFailureDiagnostics

java.lang.Object
io.jans.fido2.service.trust.NativeFailureDiagnostics

public final class NativeFailureDiagnostics extends Object
Recovers the native-failure diagnostic, if any, from the exception that failed a registration or authentication ceremony. Mirrors AttestationTrustDiagnostics for the same reasons: the code is read from a Fido2NativeFailureException in the cause chain rather than matched against the exception message, so rewording a log string never silently stops classifying failures.

Failures that are not one of these diagnostics resolve to null, and the caller keeps the original message — nothing is lost for them.

Author:
Janssen Project
  • Method Details

    • find

      public static Fido2NativeFailureException find(Throwable error)
      Finds the native failure behind a ceremony error.
      Parameters:
      error - the exception that failed the ceremony; may be null
      Returns:
      the Fido2NativeFailureException that describes the failure, or null when the failure was not one of these diagnostics
    • resolveCode

      public static String resolveCode(Throwable error)
      The diagnostic code to record for a ceremony failure.
      Parameters:
      error - the exception that failed the ceremony; may be null
      Returns:
      the code name, or null when the failure was not one of these diagnostics
    • resolve

      public static NativeFailureDiagnostic resolve(Throwable error)
      Convenience for the enum constant itself, for callers that need more than the name.