Remove unnecessary catch (#13639)

This undoes https://github.com/vercel/next.js/pull/13138 as the rename is done.
This commit is contained in:
Shu Uesugi 2020-06-01 12:27:05 -07:00 committed by GitHub
parent 795d9319a6
commit 1f49400a32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,7 +83,7 @@ export function downloadAndExtractRepo(
)
}
export async function downloadAndExtractExample(
export function downloadAndExtractExample(
root: string,
name: string
): Promise<void> {
@ -91,24 +91,10 @@ export async function downloadAndExtractExample(
throw new Error('This is an internal example for testing the CLI.')
}
try {
return await pipeline(
got.stream('https://codeload.github.com/vercel/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`])
)
} catch (err) {
// TODO: remove after this change has been landed
if (err?.response?.statusCode === 404) {
return pipeline(
got.stream('https://codeload.github.com/vercel/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [
`next.js-canary/examples/${name}`,
])
)
} else {
throw err
}
}
return pipeline(
got.stream('https://codeload.github.com/vercel/next.js/tar.gz/canary'),
tar.extract({ cwd: root, strip: 3 }, [`next.js-canary/examples/${name}`])
)
}
export async function listExamples(): Promise<any> {