Skip to content

Commit

Permalink
Remove unnecessary catch (vercel#13639)
Browse files Browse the repository at this point in the history
This undoes vercel#13138 as the rename is done.
  • Loading branch information
chibicode authored Jun 1, 2020
1 parent 795d931 commit 1f49400
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions packages/create-next-app/helpers/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,18 @@ export function downloadAndExtractRepo(
)
}

export async function downloadAndExtractExample(
export function downloadAndExtractExample(
root: string,
name: string
): Promise<void> {
if (name === '__internal-testing-retry') {
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> {
Expand Down

0 comments on commit 1f49400

Please sign in to comment.