MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / onErrorOccurred

Method onErrorOccurred

app/src/IO/Drivers/Network.cpp:529–548  ·  view source on GitHub ↗

* @brief Handles socket errors by disconnecting and showing a message box. */

Source from the content-addressed store, hash-verified

527 * @brief Handles socket errors by disconnecting and showing a message box.
528 */
529void IO::Drivers::Network::onErrorOccurred(const QAbstractSocket::SocketError socketError)
530{
531 if (m_connecting)
532 return;
533
534 if (socketType() == QAbstractSocket::UdpSocket
535 && socketError == QAbstractSocket::ConnectionRefusedError) [[unlikely]]
536 return;
537
538 QString error;
539 if (socketType() == QAbstractSocket::TcpSocket)
540 error = m_tcpSocket.errorString();
541 else if (socketType() == QAbstractSocket::UdpSocket)
542 error = m_udpSocket.errorString();
543 else
544 error = QString::number(socketError);
545
546 ConnectionManager::instance().disconnectDevice(this);
547 Misc::Utilities::showMessageBox(tr("Network socket error"), error, QMessageBox::Critical);
548}
549
550//--------------------------------------------------------------------------------------------------
551// Driver property model

Callers

nothing calls this directly

Calls 2

errorStringMethod · 0.80
disconnectDeviceMethod · 0.80

Tested by

no test coverage detected