UndefinedNameD4rtException class
Thrown when a name a script reads resolves to no declaration at all.
No interpreted catch clause may claim this. In real Dart an undefined
identifier is a compile-time error: the program never runs, so there is no
frame in which a handler could execute. D4rt discovers the same defect later,
during execution, and used to raise a plain RuntimeD4rtException — which a
bare catch (e) in the script caught like any ordinary runtime condition.
A typo therefore did not fail; it took whichever branch the handler wrote,
and the script continued on a value the author never intended. That is the
one error class where d4rt was more permissive than Dart in a way that
hides bugs instead of surfacing them.
Both catch-dispatch sites — visitTryStatement and the async state
machine's _handleAsyncError — check for this type and decline to match any
clause, so the error unwinds past every handler to the host. finally blocks
still run: the property wanted is "no catch clause can swallow it", not
"no cleanup happens".
A subtype of RuntimeD4rtException, deliberately — the same reasoning
spelled out on UndefinedMemberD4rtException. Environment.get throws on
every miss and is called speculatively all over the interpreter and the
module loader, each such caller catching RuntimeD4rtException to try the
next lookup strategy. A sibling type would have made all of those stop
catching, turning ordinary resolution fallbacks into hard failures.
name carries what the message spells, so that code branching on this failure compares a field rather than parsing a diagnostic.
- Inheritance
-
- Object
- D4rtException
- RuntimeD4rtException
- UndefinedNameD4rtException
Constructors
- UndefinedNameD4rtException(String message, {required String name})
Properties
- hasDirectiveContext ↔ bool
-
Whether message already names which module failed to load which target.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The error message.
finalinherited
- name → String
-
The identifier that resolved to nothing. Compared by equality, never
parsed.
final
- originalException → Object?
-
When this runtime error wraps a native exception thrown from a bridged
adapter (method, static method, getter, setter, operator, constructor),
the original exception object is preserved here. This lets a typed
on NativeType/ barecatchclause in interpreted code dispatch against the real exception type rather than thisRuntimeErrorwrapper. (OPEN B.5 — U13/U24.)finalinherited - originalStackTrace → StackTrace?
-
The stack trace that accompanied originalException at the point the
bridged adapter threw it.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- trackedStackTrace ↔ StackTrace?
-
Stack trace captured by ErrorReporter when tracking is enabled.
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
revoke(
) → bool -
Revokes this error from the ErrorReporter.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited