Skip to content

Commit 3a3bfb1

Browse files
committed
Try catch potential errors when parsing angular build output manifest.
1 parent 28c5147 commit 3a3bfb1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-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: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,14 @@ 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(
156+
`Failed to parse build output manifest: ${error}`,
157+
);
158+
}
152159
const manifest = buildManifestSchema.parse(parsedManifest);
153160
if (manifest["errors"].length > 0) {
154161
// errors when extracting manifest

0 commit comments

Comments
 (0)