Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c73fe01f authored by Seth Moore's avatar Seth Moore
Browse files

Don't re-wrap DeviceIdAttestationExceptions

Instead of always wrapping errors in a DeviceIdAttestationException,
check to see if the underlying cause was originally a
DeviceIdAttestationException. If so, unwrap the cause and just re-throw
that, preserving the original error.

Bug: 183827468
Test: GtsGmsCoreSecurityTestApp
Change-Id: Iab78ccaff91dd1de615e1d2b18f709027aecd59e
parent 7a622ea7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -293,6 +293,11 @@ public abstract class AttestationUtils {
        } catch (SecurityException e) {
            throw e;
        } catch (Exception e) {
            // If a DeviceIdAttestationException was previously wrapped with some other type,
            // let's throw the original exception instead of wrapping it yet again.
            if (e.getCause() instanceof DeviceIdAttestationException) {
                throw (DeviceIdAttestationException) e.getCause();
            }
            throw new DeviceIdAttestationException("Unable to perform attestation", e);
        }
    }