Skip to content

Commit 8047b02

Browse files
authored
fix: Emit a diagnostic when a --use element cannot be found (#2231)
1 parent a7c87e6 commit 8047b02

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Diff for: src/diagnosticMessages.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"Shared memory requires feature 'threads' to be enabled.": 108,
1111
"Transform '{0}': {1}": 109,
1212
"Start function name '{0}' is invalid or conflicts with another export.": 110,
13+
"Element '{0}' not found.": 111,
1314

1415
"Conversion from type '{0}' to '{1}' requires an explicit cast.": 200,
1516
"Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.": 201,

Diff for: src/program.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1421,7 +1421,7 @@ export class Program extends DiagnosticEmitter {
14211421
if (elementsByName.has(name)) {
14221422
elementsByName.set(alias, assert(elementsByName.get(name)));
14231423
} else {
1424-
throw new Error("no such global element: " + name);
1424+
this.error(DiagnosticCode.Element_0_not_found, null, name);
14251425
}
14261426
}
14271427
}

0 commit comments

Comments
 (0)