Skip to content

Commit efb210d

Browse files
authored
Try catch potential errors when parsing angular build output manifest. (#415)
* Try catch potential errors when parsing angular build output manifest. * lint
1 parent 78e31fd commit efb210d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/@apphosting/adapter-angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apphosting/adapter-angular",
3-
"version": "17.2.16",
3+
"version": "17.2.17",
44
"main": "dist/index.js",
55
"description": "Experimental addon to the Firebase CLI to add web framework support",
66
"repository": {

packages/@apphosting/adapter-angular/src/utils.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@ export function populateOutputBundleOptions(outputPaths: OutputPaths): OutputBun
148148
export function parseOutputBundleOptions(buildOutput: string): OutputBundleOptions {
149149
const strippedManifest = extractManifestOutput(buildOutput);
150150
// TODO: add functional tests that test this flow
151-
const parsedManifest = JSON.parse(strippedManifest.replace(/[\r\n]+/g, "")) as string;
151+
let parsedManifest;
152+
try {
153+
parsedManifest = JSON.parse(strippedManifest.replace(/[\r\n]+/g, "")) as string;
154+
} catch (error) {
155+
throw new Error(`Failed to parse build output manifest: ${error}`);
156+
}
152157
const manifest = buildManifestSchema.parse(parsedManifest);
153158
if (manifest["errors"].length > 0) {
154159
// errors when extracting manifest

0 commit comments

Comments
 (0)