mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03:00
SQLStudio: Display error message boxes when connections/executions fail
In a GUI application, this is vastly more useful than logging to the terminal or ignoring the error completely.
This commit is contained in:
parent
5822520e6d
commit
690389ae81
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/690389ae81 Pull-request: https://github.com/SerenityOS/serenity/pull/16710
@ -168,7 +168,7 @@ MainWidget::MainWidget()
|
||||
m_connection_id = *connection_id;
|
||||
m_run_script_action->set_enabled(true);
|
||||
} else {
|
||||
warnln("\033[33;1mCould not connect to:\033[0m {}", database_name);
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Could not connect to {}", database_name));
|
||||
}
|
||||
});
|
||||
|
||||
@ -257,6 +257,12 @@ MainWidget::MainWidget()
|
||||
m_sql_client->on_execution_success = [this](auto, auto, auto, auto, auto, auto) {
|
||||
read_next_sql_statement_of_editor();
|
||||
};
|
||||
m_sql_client->on_execution_error = [this](auto, auto, auto, auto message) {
|
||||
auto* editor = active_editor();
|
||||
VERIFY(editor);
|
||||
|
||||
GUI::MessageBox::show_error(window(), DeprecatedString::formatted("Error executing {}\n{}", editor->path(), message));
|
||||
};
|
||||
m_sql_client->on_next_result = [this](auto, auto, auto row) {
|
||||
m_results.append({});
|
||||
m_results.last().ensure_capacity(row.size());
|
||||
|
Loading…
Reference in New Issue
Block a user