| 90 | } |
| 91 | |
| 92 | void InternalErrorsDialog::internalAddError(const InternalError &error) |
| 93 | { |
| 94 | const QString url = error.url.toString(); |
| 95 | auto *const b = browser(); |
| 96 | b->append(QChar('[') % QString::fromUtf8(error.when.toString(DateTimeOutputFormat::Iso, true).data()) % QChar(']') % QChar(' ') % error.message); |
| 97 | if (!url.isEmpty()) { |
| 98 | b->append(m_request % QChar(' ') % url); |
| 99 | } |
| 100 | if (!error.response.isEmpty()) { |
| 101 | b->append(m_response % QChar('\n') % QString::fromLocal8Bit(error.response)); |
| 102 | } |
| 103 | |
| 104 | // also log errors to console |
| 105 | using namespace EscapeCodes; |
| 106 | cerr << Phrases::Error << error.message.toLocal8Bit().data() << Phrases::End; |
| 107 | if (!error.url.isEmpty()) { |
| 108 | cerr << "request URL: " << url.toLocal8Bit().data() << '\n'; |
| 109 | } |
| 110 | if (!error.response.isEmpty()) { |
| 111 | cerr << "response: " << error.response.data() << '\n'; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | void InternalErrorsDialog::updateStatusLabel() |
| 116 | { |