Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasFella committed Dec 7, 2024
1 parent a0dcc7f commit 674b70f
Show file tree
Hide file tree
Showing 5 changed files with 992 additions and 604 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ target_sources(${QUOTIENT_LIB_NAME} PUBLIC FILE_SET HEADERS BASE_DIRS .
Quotient/jobs/mediathumbnailjob.cpp
Quotient/jobs/downloadfilejob.cpp
Quotient/keyverificationsession.cpp
Quotient/e2ee/e2ee_common.cpp
Quotient/keyimport.cpp
libquotientemojis.qrc
)
Expand Down
6 changes: 6 additions & 0 deletions Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ void Connection::Private::setupCryptoMachine(const QByteArray& picklingKey)
mxIdForDb.replace(u':', u'_');
const QString databasePath{ QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) % u'/' % mxIdForDb % u'/' % q->deviceId() };
cryptoMachine = crypto::init(stringToRust(q->userId()), stringToRust(q->deviceId()), stringToRust(databasePath), bytesToRust(picklingKey));
if (!(*cryptoMachine)->is_ok()) {
//TODO as part of #782: if crypto machine creation fails, make PendingConnection fail to create a Connection. Then clients can show these errors nicely
// and we don't have to guard all functions for the crypto machine not being available.
qCritical() << "Failed to load crypto machine" << (int) (*cryptoMachine)->error() << stringFromRust((*cryptoMachine)->error_string());
qApp->exit(1);
}
}

void Connection::Private::completeSetup(const QString& mxId, bool newLogin,
Expand Down
Loading

0 comments on commit 674b70f

Please sign in to comment.