Skip to content

Commit fe4c0cd

Browse files
committed
better error messages
1 parent cb4bbda commit fe4c0cd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/repl/src/lib/workers/bundler/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ async function get_bundle(
193193
}
194194
}
195195

196-
throw new Error(`Could not resolve ${importee} from ${importer}`);
196+
throw new Error(
197+
`'${importee}' (imported by ${importer.replace(VIRTUAL + '/', '')}) does not exist`
198+
);
197199
}
198200

199201
if (importer.startsWith(NPM)) {

packages/repl/src/lib/workers/npm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export function resolve_subpath(pkg: Package, subpath: string): string {
137137
return resolved?.[0] as string;
138138
} catch {
139139
throw new Error(
140-
`no matched export path was found for "${subpath}" in "${pkg.meta.name}/package.json"`
140+
`No matched export path was found for "${subpath}" in "${pkg.meta.name}/package.json"`
141141
);
142142
}
143143
}
@@ -164,7 +164,7 @@ export function resolve_subpath(pkg: Package, subpath: string): string {
164164
if (pkg.contents['index.mjs']) return './index.mjs';
165165
if (pkg.contents['index.js']) return './index.js';
166166

167-
throw new Error(`could not find entry point in "${pkg.meta.name}/package.json"`);
167+
throw new Error(`Could not find entry point in "${pkg.meta.name}/package.json"`);
168168
}
169169

170170
return resolved_id as string;

0 commit comments

Comments
 (0)