diff --git a/android/android-certificate-unpinning-fallback.js b/android/android-certificate-unpinning-fallback.js index e329453..6896cb6 100644 --- a/android/android-certificate-unpinning-fallback.js +++ b/android/android-certificate-unpinning-fallback.js @@ -108,10 +108,14 @@ Java.perform(function () { }; const buildUnhandledErrorPatcher = (errorClassName, originalConstructor) => { - return function (errorMessage) { + return function (errorArg) { try { console.log('\n !!! --- Unexpected TLS failure --- !!!'); + // This may be a message, or an cause, or plausibly maybe other types? But + // stringifying gives something consistently message-shaped, so that'll do. + const errorMessage = errorArg?.toString() ?? ''; + // Parse the stack trace to work out who threw this error: const stackTrace = Java.use('java.lang.Thread').currentThread().getStackTrace(); const exceptionStackIndex = stackTrace.findIndex(stack =>