mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-11 15:56:17 -07:00
Make WebUI error non-fatal
* Do not exit the app when WebUI is failed for start. * Print the error to stdout. PR #19697. Closes #19695. Closes #19469.
This commit is contained in:
parent
6860c0d60d
commit
35e4b35d12
3 changed files with 21 additions and 9 deletions
|
@ -890,13 +890,17 @@ int Application::exec()
|
|||
#ifndef DISABLE_WEBUI
|
||||
m_webui = new WebUI(this);
|
||||
#ifdef DISABLE_GUI
|
||||
if (m_webui->isErrored())
|
||||
QCoreApplication::exit(EXIT_FAILURE);
|
||||
connect(m_webui, &WebUI::fatalError, this, []() { QCoreApplication::exit(EXIT_FAILURE); });
|
||||
connect(m_webui, &WebUI::error, this, [](const QString &message) { fprintf(stderr, "%s\n", qUtf8Printable(message)); });
|
||||
|
||||
printf("%s", qUtf8Printable(u"\n******** %1 ********\n"_s.arg(tr("Information"))));
|
||||
|
||||
if (m_webui->isEnabled())
|
||||
if (m_webui->isErrored())
|
||||
{
|
||||
const QString error = m_webui->errorMessage() + u'\n'
|
||||
+ tr("To fix the error, you may need to edit the config file manually.");
|
||||
fprintf(stderr, "%s\n", qUtf8Printable(error));
|
||||
}
|
||||
else if (m_webui->isEnabled())
|
||||
{
|
||||
const QHostAddress address = m_webui->hostAddress();
|
||||
const QString url = u"%1://%2:%3"_s.arg((m_webui->isHttps() ? u"https"_s : u"http"_s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue