mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-18 16:17:03 +00:00
fix(GODT-2449): fix bug in Bridge-GUI's Exception::what().
This commit is contained in:
@ -26,9 +26,10 @@ namespace bridgepp {
|
|||||||
/// \param[in] what A description of the exception.
|
/// \param[in] what A description of the exception.
|
||||||
/// \param[in] details The optional details for the exception.
|
/// \param[in] details The optional details for the exception.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
Exception::Exception(QString what, QString details) noexcept
|
Exception::Exception(QString qwhat, QString details) noexcept
|
||||||
: std::exception()
|
: std::exception()
|
||||||
, what_(std::move(what))
|
, qwhat_(std::move(qwhat))
|
||||||
|
, what_(qwhat_.toLocal8Bit())
|
||||||
, details_(std::move(details)) {
|
, details_(std::move(details)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +39,7 @@ Exception::Exception(QString what, QString details) noexcept
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
Exception::Exception(Exception const &ref) noexcept
|
Exception::Exception(Exception const &ref) noexcept
|
||||||
: std::exception(ref)
|
: std::exception(ref)
|
||||||
|
, qwhat_(ref.qwhat_)
|
||||||
, what_(ref.what_)
|
, what_(ref.what_)
|
||||||
, details_(ref.details_) {
|
, details_(ref.details_) {
|
||||||
}
|
}
|
||||||
@ -48,6 +50,7 @@ Exception::Exception(Exception const &ref) noexcept
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
Exception::Exception(Exception &&ref) noexcept
|
Exception::Exception(Exception &&ref) noexcept
|
||||||
: std::exception(ref)
|
: std::exception(ref)
|
||||||
|
, qwhat_(ref.qwhat_)
|
||||||
, what_(ref.what_)
|
, what_(ref.what_)
|
||||||
, details_(ref.details_) {
|
, details_(ref.details_) {
|
||||||
}
|
}
|
||||||
@ -57,7 +60,7 @@ Exception::Exception(Exception &&ref) noexcept
|
|||||||
/// \return a string describing the exception
|
/// \return a string describing the exception
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
QString Exception::qwhat() const noexcept {
|
QString Exception::qwhat() const noexcept {
|
||||||
return what_;
|
return qwhat_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +68,7 @@ QString Exception::qwhat() const noexcept {
|
|||||||
/// \return A pointer to the description string of the exception.
|
/// \return A pointer to the description string of the exception.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
const char *Exception::what() const noexcept {
|
const char *Exception::what() const noexcept {
|
||||||
return what_.toLocal8Bit().constData();
|
return what_.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace bridgepp {
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
class Exception : public std::exception {
|
class Exception : public std::exception {
|
||||||
public: // member functions
|
public: // member functions
|
||||||
explicit Exception(QString what = QString(), QString details = QString()) noexcept; ///< Constructor
|
explicit Exception(QString qwhat = QString(), QString details = QString()) noexcept; ///< Constructor
|
||||||
Exception(Exception const &ref) noexcept; ///< copy constructor
|
Exception(Exception const &ref) noexcept; ///< copy constructor
|
||||||
Exception(Exception &&ref) noexcept; ///< copy constructor
|
Exception(Exception &&ref) noexcept; ///< copy constructor
|
||||||
Exception &operator=(Exception const &) = delete; ///< Disabled assignment operator
|
Exception &operator=(Exception const &) = delete; ///< Disabled assignment operator
|
||||||
@ -42,7 +42,8 @@ public: // member functions
|
|||||||
QString details() const noexcept; ///< Return the details for the exception
|
QString details() const noexcept; ///< Return the details for the exception
|
||||||
|
|
||||||
private: // data members
|
private: // data members
|
||||||
QString const what_; ///< The description of the exception.
|
QString const qwhat_; ///< The description of the exception.
|
||||||
|
QByteArray const what_; ///< The c-string version of the qwhat message. Stored as a QByteArray for automatic lifetime management.
|
||||||
QString const details_; ///< The optional details for the exception.
|
QString const details_; ///< The optional details for the exception.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user