Skip to content
This repository has been archived by the owner on Jun 11, 2020. It is now read-only.

Commit

Permalink
feat(definition-parser): include package name in error
Browse files Browse the repository at this point in the history
This proposed change is intended to allow developers quickly figure out
the real reason of `getTypingInfo` failing due to version mismatch.
Current error message and related stack trace does not contain a clue
about the package failing and with the context of DT repository and
local development artifacts, this removes the problem with definition
parser failing on the stale data from local repository (non tracked
folders, etc).

Thanks!
  • Loading branch information
peterblazejewicz committed May 25, 2020
1 parent 5873558 commit cfe160b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/definition-parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe(getTypingInfo, () => {
expect(() => {
getTypingInfo("jquery", dt.pkgFS("jquery"));
}).toThrow(
"The latest version is 3.3, so the subdirectory 'v3.3' is not allowed.",
"The latest version of the 'jquery' package is 3.3, so the subdirectory 'v3.3' is not allowed.",
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/definition-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function getTypingInfo(packageName: string, fs: FS): TypingsVersionsRaw {
if (matchesVersion(latestData, directoryVersion, considerLibraryMinorVersion)) {
const latest = `${latestData.libraryMajorVersion}.${latestData.libraryMinorVersion}`;
throw new Error(
`The latest version is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
`The latest version of the '${packageName}' package is ${latest}, so the subdirectory '${directoryName}' is not allowed` +
(`v${latest}` === directoryName ?
"." : `; since it applies to any ${latestData.libraryMajorVersion}.* version, up to and including ${latest}.`),
);
Expand Down

0 comments on commit cfe160b

Please sign in to comment.