diff --git a/site/src/pages/Package.svelte b/site/src/pages/Package.svelte index f0e466f..64e9455 100644 --- a/site/src/pages/Package.svelte +++ b/site/src/pages/Package.svelte @@ -41,15 +41,18 @@ // prettier-ignore `${import.meta.env.VITE_NPM_REGISTRY}/${encodeURIComponent(npmPkgName)}/latest` ) - .then((v) => v.ok && v.json()) - .then((v) => { - if (v?.version) { - url.replace(`/${npmPkgName}@${v.version}`) - } - }) - .finally(() => { - versionFetched = true - }) + .then(async (res) => { + const result = await res.json() + if (typeof result === 'string') { + error = result + return + } + if (result?.version) { + url.replace(`/${npmPkgName}@${result.version}`) + } + }).finally(() => { + versionFetched = true + }) } /** @type {Worker} */ @@ -146,7 +149,9 @@ {#if npmPkgName}
{#if repo}