Skip to content

Commit 84c9463

Browse files
committed
Improve error handling & logging of failed cert setup
1 parent 965fd8d commit 84c9463

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/interceptors/android/adb-commands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,10 @@ export async function injectSystemCertificate(
352352

353353
// Actually run the script that we just pushed above, as root
354354
const scriptOutput = await run(adbClient, runAsRoot('sh', injectionScriptPath));
355-
console.log(scriptOutput);
355+
356+
if (!scriptOutput.includes("System cert successfully injected")) {
357+
throw new Error('System certificate injection failed');
358+
}
356359
}
357360

358361
export async function setChromeFlags(

src/interceptors/android/android-adb-interceptor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,9 @@ export class AndroidAdbInterceptor implements Interceptor {
210210
0o444
211211
);
212212

213-
await injectSystemCertificate(deviceClient, rootCmd, certPath);
214-
console.log(`Cert injected`);
213+
await injectSystemCertificate(deviceClient, rootCmd, certPath)
214+
.then(() => console.log('Cert injected'))
215+
.catch((e) => logError(e)); // Continue but log the failure
215216
} else {
216217
console.log("Cert already installed, nothing to do");
217218
}

0 commit comments

Comments
 (0)