Skip to content

Commit

Permalink
Improve import error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Oct 2, 2022
1 parent 1ede1d2 commit 134e3a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/JavaScriptCore/runtime/JSModuleRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ void JSModuleRecord::instantiateDeclarations(JSGlobalObject* globalObject, Modul
RETURN_IF_EXCEPTION(scope, void());
switch (resolution.type) {
case Resolution::Type::NotFound:
throwSyntaxError(globalObject, scope, makeString("Importing binding name '", String(importEntry.importName.impl()), "' is not found."));
throwSyntaxError(globalObject, scope, makeString("Import named '", String(importEntry.importName.impl()), "' not found in module '", importedModule->moduleKey().string(), "'."));
return;

case Resolution::Type::Ambiguous:
throwSyntaxError(globalObject, scope, makeString("Importing binding name '", String(importEntry.importName.impl()), "' cannot be resolved due to ambiguous multiple bindings."));
throwSyntaxError(globalObject, scope, makeString("Import named '", String(importEntry.importName.impl()), "' cannot be resolved due to ambiguous multiple bindings in module '", importedModule->moduleKey().string(), "'."));
return;

case Resolution::Type::Error:
throwSyntaxError(globalObject, scope, makeString("Importing binding name 'default' cannot be resolved by star export entries."));
throwSyntaxError(globalObject, scope, makeString("Missing 'default' import in module '", importedModule->moduleKey().string(), "'."));
return;

case Resolution::Type::Resolved: {
Expand Down

0 comments on commit 134e3a7

Please sign in to comment.