[ VM ] Print more useful error message when trying to run a program with no `main`
Fixes https://github.com/dart-lang/sdk/issues/49432
TEST=Manual verification
Change-Id: Iba652016dc62306a883587b05506ee76cc650c20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251122
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index adac74b..32954d6 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -5503,8 +5503,10 @@
// is not correct because main can be in the exported namespace of a library
// or it could be a getter.
if (tmp.IsNull()) {
- return Api::NewError("%s: The binary program does not contain 'main'.",
- CURRENT_FUNC);
+ return Api::NewError(
+ "Invoked Dart programs must have a 'main' function defined:\n"
+ "https://dart.dev/guides/language/"
+ "language-tour#a-basic-dart-program");
}
library ^= tmp.ptr();
IG->object_store()->set_root_library(library);