Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packages/cli/src/commands/react-native/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,13 @@ function runWrappedBuild(

const status = runScript(script, scriptArgs, env);

const report = JSON.parse(
readFileSync(reportPath, "utf-8")
) as SourceMapReport;
let report: SourceMapReport;
try {
report = JSON.parse(readFileSync(reportPath, "utf-8")) as SourceMapReport;
} catch (error) {
log.debug("Failed to read sourcemap report file", error);
return { status, pair: null };
}
if (!(report.packager_bundle_path && report.packager_sourcemap_path)) {
return { status, pair: null };
}
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/lib/api/seer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
* which returns blocks instead of steps.
*/

import type { AutofixResponse, AutofixState } from "../../types/seer.js";
import {
AutofixResponseSchema,
type AutofixResponse,
type AutofixState,
} from "../../types/seer.js";

import { resolveOrgRegion } from "../region.js";

Expand Down Expand Up @@ -96,6 +100,7 @@ export async function getAutofixState(
`/organizations/${orgSlug}/issues/${issueId}/autofix/`,
{
params: EXPLORER_MODE_PARAMS,
schema: AutofixResponseSchema,
}
);

Expand Down
20 changes: 18 additions & 2 deletions packages/cli/src/lib/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,15 @@ export async function fetchLatestFromGitHub(
);
}

const data = (await response.json()) as { tag_name?: string };
let data: { tag_name?: string };
try {
data = (await response.json()) as { tag_name?: string };
} catch {
throw new UpgradeError(
"network_error",
"GitHub returned non-JSON response"
);
}

if (!data.tag_name) {
throw new UpgradeError(
Expand Down Expand Up @@ -422,7 +430,15 @@ export async function fetchLatestFromNpm(): Promise<string> {
);
}

const data = (await response.json()) as { version?: string };
let data: { version?: string };
try {
data = (await response.json()) as { version?: string };
} catch {
throw new UpgradeError(
"network_error",
"npm registry returned non-JSON response"
);
}

if (!data.version) {
throw new UpgradeError("network_error", "No version found in npm registry");
Expand Down
Loading