From 800a54615af3d6ea96add0fcea90d93258d7e23c Mon Sep 17 00:00:00 2001 From: Kamal Mahyuddin Date: Tue, 22 Jun 2021 12:35:12 -0700 Subject: [PATCH] fix: handle 404 from registry if the host cli hasn't published any packages --- src/hooks/init/check-update.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hooks/init/check-update.ts b/src/hooks/init/check-update.ts index e2e16761..753b81c9 100644 --- a/src/hooks/init/check-update.ts +++ b/src/hooks/init/check-update.ts @@ -35,6 +35,12 @@ const hook: Hook<"init"> = async function ({ config }) { await fs.writeFile(updateCheckPath, JSON.stringify(latestManifest), { encoding: "utf8", }); + } catch (error) { + // when the host has not yet published any packages, the registry will return a 404. + // we swallow this error to avoid erroring out the host cli + if (error.code !== "E404") { + throw error; + } } finally { cli.action.stop(); }