diff options
author | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-24 00:49:44 +0200 |
---|---|---|
committer | Ignacio Etcheverry <ignalfonsore@gmail.com> | 2017-10-24 00:49:44 +0200 |
commit | 9905002fa68f151f90a588a2c4b62b939ff31a0d (patch) | |
tree | 22c4a4bdb1ced8d656a0547a9b0074762859954b | |
parent | 45e5e23ee83d202461f1753b1d94afc51d3a5aa1 (diff) |
Mono: Fix and cleanup build start errors
-rw-r--r-- | modules/mono/editor/godotsharp_builds.cpp | 23 | ||||
-rw-r--r-- | modules/mono/editor/mono_bottom_panel.cpp | 22 | ||||
-rw-r--r-- | modules/mono/editor/mono_bottom_panel.h | 2 |
3 files changed, 28 insertions, 19 deletions
diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index 1bad8a3f85..d3808769fb 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -395,10 +395,11 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { } if (!exited) { - ERR_PRINT("BuildProcess::start called, but process still running"); exited = true; - build_tab->on_build_exec_failed("!exited"); - return; + String message = "Tried to start build process, but it is already running"; + build_tab->on_build_exec_failed(message); + ERR_EXPLAIN(message); + ERR_FAIL(); } exited = false; @@ -410,10 +411,12 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { if (d->file_exists(issues_file)) { Error err = d->remove(issues_file); if (err != OK) { - ERR_PRINTS("Cannot remove file: " + logs_dir.plus_file(issues_file)); exited = true; - build_tab->on_build_exec_failed("Cannot remove file: " + issues_file); - return; + String file_path = ProjectSettings::get_singleton()->localize_path(logs_dir).plus_file(issues_file); + String message = "Cannot remove issues file: " + file_path; + build_tab->on_build_exec_failed(message); + ERR_EXPLAIN(message); + ERR_FAIL(); } } @@ -434,7 +437,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { if (ex) { exited = true; - build_tab->on_build_exec_failed("The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex)); + String message = "The build constructor threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex); + build_tab->on_build_exec_failed(message); + ERR_EXPLAIN(message); ERR_FAIL(); } @@ -452,7 +457,9 @@ void GodotSharpBuilds::BuildProcess::start(bool p_blocking) { if (ex) { exited = true; - build_tab->on_build_exec_failed("The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex)); + String message = "The build method threw an exception.\n" + GDMonoUtils::get_exception_name_and_message(ex); + build_tab->on_build_exec_failed(message); + ERR_EXPLAIN(message); ERR_FAIL(); } diff --git a/modules/mono/editor/mono_bottom_panel.cpp b/modules/mono/editor/mono_bottom_panel.cpp index 07109eaac7..8d6a618ee8 100644 --- a/modules/mono/editor/mono_bottom_panel.cpp +++ b/modules/mono/editor/mono_bottom_panel.cpp @@ -280,7 +280,11 @@ void MonoBuildTab::_update_issues_list() { String tooltip; tooltip += String("Message: ") + issue.message; - tooltip += String("\nCode: ") + issue.code; + + if (issue.code.length()) { + tooltip += String("\nCode: ") + issue.code; + } + tooltip += String("\nType: ") + (issue.warning ? "warning" : "error"); String text; @@ -356,23 +360,21 @@ void MonoBuildTab::on_build_exit(BuildResult result) { MonoBottomPanel::get_singleton()->raise_build_tab(this); } -void MonoBuildTab::on_build_exec_failed(const String &p_cause, const String &p_detailed) { +void MonoBuildTab::on_build_exec_failed(const String &p_cause) { build_exited = true; build_result = RESULT_ERROR; issues_list->clear(); - String tooltip; + BuildIssue issue; + issue.message = p_cause; + issue.warning = false; - tooltip += "Message: " + (p_detailed.length() ? p_detailed : p_cause); - tooltip += "\nType: error"; + error_count += 1; + issues.push_back(issue); - int line_break_idx = p_cause.find("\n"); - issues_list->add_item(line_break_idx == -1 ? p_cause : p_cause.substr(0, line_break_idx), - get_icon("Error", "EditorIcons")); - int index = issues_list->get_item_count() - 1; - issues_list->set_item_tooltip(index, tooltip); + _update_issues_list(); MonoBottomPanel::get_singleton()->raise_build_tab(this); } diff --git a/modules/mono/editor/mono_bottom_panel.h b/modules/mono/editor/mono_bottom_panel.h index 909fa4b385..83da5b9809 100644 --- a/modules/mono/editor/mono_bottom_panel.h +++ b/modules/mono/editor/mono_bottom_panel.h @@ -134,7 +134,7 @@ public: void on_build_start(); void on_build_exit(BuildResult result); - void on_build_exec_failed(const String &p_cause, const String &p_detailed = String()); + void on_build_exec_failed(const String &p_cause); void restart_build(); void stop_build(); |