Skip to content

Commit 77f486f

Browse files
committed
fix: reduce Android reverse error complexity
1 parent 0fc40b4 commit 77f486f

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/platforms/android/app-lifecycle.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,17 +247,21 @@ async function ensureAndroidLocalhostReverse(device: DeviceInfo, target: string)
247247
try {
248248
await reverse.ensure({ local: endpoint, remote: endpoint });
249249
} catch (error) {
250-
const causeDetails = error instanceof AppError ? error.details : undefined;
250+
const details = {
251+
localPort: endpoint.replace('tcp:', ''),
252+
operation: `adb reverse ${endpoint} ${endpoint}`,
253+
};
254+
if (error instanceof AppError) {
255+
Object.assign(details, {
256+
hint: error.details?.hint,
257+
diagnosticId: error.details?.diagnosticId,
258+
logPath: error.details?.logPath,
259+
});
260+
}
251261
throw new AppError(
252262
'COMMAND_FAILED',
253263
`Failed to ensure Android port reverse ${endpoint} before opening localhost URL`,
254-
{
255-
localPort: endpoint.replace('tcp:', ''),
256-
operation: `adb reverse ${endpoint} ${endpoint}`,
257-
...(causeDetails?.hint ? { hint: causeDetails.hint } : {}),
258-
...(causeDetails?.diagnosticId ? { diagnosticId: causeDetails.diagnosticId } : {}),
259-
...(causeDetails?.logPath ? { logPath: causeDetails.logPath } : {}),
260-
},
264+
details,
261265
error,
262266
);
263267
}

0 commit comments

Comments
 (0)