From 693935c1693dd60aa68fcfbe3d343c85210a0503 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 15 Mar 2016 14:06:20 -0700 Subject: [PATCH] Don't dump core on startup exceptions Instead, log the exception to the console and exit with an error code. Fixes #2362 --- sky/engine/core/script/dart_controller.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sky/engine/core/script/dart_controller.cc b/sky/engine/core/script/dart_controller.cc index 7f342da0d1d..dbd1f661d95 100644 --- a/sky/engine/core/script/dart_controller.cc +++ b/sky/engine/core/script/dart_controller.cc @@ -83,7 +83,8 @@ bool DartController::SendStartMessage(Dart_Handle root_library) { ToDart("_getMainClosure"), 0, NULL); - DART_CHECK_VALID(main_closure); + if (LogIfError(main_closure)) + return true; // Send the start message containing the entry point by calling // _startMainIsolate in dart:isolate. @@ -122,8 +123,9 @@ void DartController::DidLoadSnapshot() { DartApiScope dart_api_scope; Dart_Handle library = Dart_RootLibrary(); if (LogIfError(library)) - return; - SendStartMessage(library); + exit(1); + if (SendStartMessage(library)) + exit(1); } void DartController::RunFromPrecompiledSnapshot() { @@ -143,8 +145,9 @@ void DartController::RunFromSnapshotBuffer(const uint8_t* buffer, size_t size) { LogIfError(Dart_LoadScriptFromSnapshot(buffer, size)); Dart_Handle library = Dart_RootLibrary(); if (LogIfError(library)) - return; - SendStartMessage(library); + exit(1); + if (SendStartMessage(library)) + exit(1); } void DartController::RunFromLibrary(const std::string& name,