Skip to content

Commit

Permalink
Don’t crash when implementation package fails to extract (#948)
Browse files Browse the repository at this point in the history
* Wrap createPackage in try/catch

* Add changeset

* Fix package lock
  • Loading branch information
andrewbranch authored Feb 12, 2024
1 parent 4b738ac commit aa26880
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/little-timers-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@definitelytyped/dtslint": patch
---

Don’t crash when implementation package fails to extract
9 changes: 8 additions & 1 deletion packages/dtslint/src/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,14 @@ export async function checkNpmVersionAndGetMatchingImplementationPackage(
`that does not conflict with an existing npm package.`,
);
} else {
implementationPackage = await attw.createPackageFromTarballUrl(tarballUrl);
try {
implementationPackage = await attw.createPackageFromTarballUrl(tarballUrl);
} catch (err: any) {
(warnings ??= []).push(
`Failed to extract implementation package from ${tarballUrl}. This is likely a problem with @arethetypeswrong/core ` +
`or the tarball data itself. @arethetypeswrong/cli will not run. Error:\n${err.stack ?? err.message}`
);
}
}
}
} else if (packageJson.nonNpm === "conflict") {
Expand Down

0 comments on commit aa26880

Please sign in to comment.