refactor(adb): encode package verdict certainty in the result type
This commit is contained in:
1 parent
b31f52946f
commit
75ca7c02ec
2 files changed
+5
-6
No files matched your search
@@ -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(
|
||||
|
||||
@@ -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 };
|
||||
|
||||
Reference in new issue
Block a user