Fix unnecessary 'still authorizing' error

Summary:
When connection to Android, I always get an error popup with 'device still authorizing', which disappears itself and the device connects fine. It seems that this was a case we handled gracefully before, but the error message we check for has changed. Also updated the log message so that we get it in our monitoring I don't silently get stuck in this state.

Changelog: Fixed 'device still authorizing' errors showing up while connecting to an Android device

Reviewed By: aigoncharov

Differential Revision: D33976028

fbshipit-source-id: dbb055bbbd43bad129b10ffee4a8dbb50be8e87a
This commit is contained in:
Michel Weststrate
2022-02-03 04:19:07 -08:00
committed by Facebook GitHub Bot
parent ccea9058ef
commit a31494f321

View File

@@ -91,16 +91,14 @@ export class AndroidDeviceManager {
reject(e);
}
} catch (e) {
const message = `${e.message ?? e}`;
if (
e &&
e.message &&
e.message === `Failure: 'device still connecting'`
message.includes('device still connecting') ||
message.includes('device still authorizing')
) {
console.debug('Device still connecting: ' + device.id);
console.log('[conn] Device still connecting: ' + device.id);
} else {
const isAuthorizationError = (e?.message as string)?.includes(
'device unauthorized',
);
const isAuthorizationError = message.includes('device unauthorized');
if (!isAuthorizationError) {
console.error('Failed to connect to android device', e);
}
@@ -109,7 +107,7 @@ export class AndroidDeviceManager {
title: 'Could not connect to ' + device.id,
description: isAuthorizationError
? 'Make sure to authorize debugging on the phone'
: 'Failed to setup connection: ' + e,
: 'Failed to setup connection: ' + message,
});
}
resolve(undefined); // not ready yet, we will find it in the next tick