refactor(adb): encode package verdict certainty in the result type

This commit is contained in:
morluto committed 2026-10-24 02:29:08 +08:00
1 parent b31f52946f
commit 75ca7c02ec
2 files changed
+5 -6

No files matched your search

+2 -2
View File
@@ -2693,7 +2693,7 @@ export class AdbProvider {
new AnalysisUnsupportedTargetError(
operation,
input.serial,
verdict.reason ?? "the device refused the installation",
verdict.reason,
),
);
return ok(
@@ -2767,7 +2767,7 @@ export class AdbProvider {
new AnalysisUnsupportedTargetError(
operation,
input.serial,
verdict.reason ?? "the device refused the removal",
verdict.reason,
),
);
return ok(
+3 -4
View File
@@ -418,10 +418,9 @@ export const packageChangeFailureReason = (output: string): string | null =>
*/
export const parsePackageChangeOutput = (
stdout: string,
): {
readonly status: "success" | "failure" | "unknown";
readonly reason: string | null;
} => {
):
| { readonly status: "success" | "unknown"; readonly reason: null }
| { readonly status: "failure"; readonly reason: string } => {
const text = stdout.trim();
const failure = packageChangeFailureReason(text);
if (failure !== null) return { status: "failure", reason: failure };