Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3701008
D8114.id27648.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D8114.id27648.diff
View Options
diff --git a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
--- a/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/CryptoModule.cpp
@@ -35,7 +35,9 @@
if (-1 ==
::olm_create_account(this->account, randomBuffer.data(), randomSize)) {
- throw std::runtime_error{"error createAccount => ::olm_create_account"};
+ throw std::runtime_error{
+ "error createAccount => " +
+ std::string{::olm_account_last_error(this->account)}};
};
}
@@ -52,7 +54,8 @@
this->keys.identityKeys.data(),
this->keys.identityKeys.size())) {
throw std::runtime_error{
- "error generateIdentityKeys => ::olm_account_identity_keys"};
+ "error generateIdentityKeys => " +
+ std::string{::olm_account_last_error(this->account)}};
}
}
@@ -69,7 +72,8 @@
::olm_account_generate_one_time_keys(
this->account, oneTimeKeysAmount, random.data(), random.size())) {
throw std::runtime_error{
- "error generateOneTimeKeys => ::olm_account_generate_one_time_keys"};
+ "error generateOneTimeKeys => " +
+ std::string{::olm_account_last_error(this->account)}};
}
}
@@ -83,7 +87,8 @@
this->keys.oneTimeKeys.data(),
this->keys.oneTimeKeys.size())) {
throw std::runtime_error{
- "error publishOneTimeKeys => ::olm_account_one_time_keys"};
+ "error publishOneTimeKeys => " +
+ std::string{::olm_account_last_error(this->account)}};
}
return ::olm_account_mark_keys_as_published(this->account);
}
@@ -249,7 +254,9 @@
secretKey.size(),
accountPickleBuffer.data(),
accountPickleLength)) {
- throw std::runtime_error{"error storeAsB64 => ::olm_pickle_account"};
+ throw std::runtime_error{
+ "error storeAsB64 => " +
+ std::string{::olm_account_last_error(this->account)}};
}
persist.account = accountPickleBuffer;
@@ -274,7 +281,9 @@
secretKey.size(),
persist.account.data(),
persist.account.size())) {
- throw std::runtime_error{"error restoreFromB64 => ::olm_unpickle_account"};
+ throw std::runtime_error{
+ "error restoreFromB64 => " +
+ std::string{::olm_account_last_error(this->account)}};
}
std::unordered_map<std::string, OlmBuffer>::iterator it;
@@ -307,7 +316,8 @@
messageRandom.size(),
encryptedMessage.data(),
encryptedMessage.size())) {
- throw std::runtime_error{"error encrypt => ::olm_encrypt"};
+ throw std::runtime_error{
+ "error encrypt => " + std::string{::olm_session_last_error(session)}};
}
return {encryptedMessage, messageType};
}
@@ -336,7 +346,8 @@
decryptedMessage.data(),
decryptedMessage.size());
if (decryptedSize == -1) {
- throw std::runtime_error{"error ::olm_decrypt"};
+ throw std::runtime_error{
+ "error decrypt => " + std::string{::olm_session_last_error(session)}};
}
return std::string{(char *)decryptedMessage.data(), decryptedSize};
}
diff --git a/native/cpp/CommonCpp/CryptoTools/Session.cpp b/native/cpp/CommonCpp/CryptoTools/Session.cpp
--- a/native/cpp/CommonCpp/CryptoTools/Session.cpp
+++ b/native/cpp/CommonCpp/CryptoTools/Session.cpp
@@ -42,7 +42,8 @@
randomBuffer.data(),
randomBuffer.size())) {
throw std::runtime_error(
- "error createOutbound => ::olm_create_outbound_session");
+ "error createOutbound => " +
+ std::string{::olm_session_last_error(session->olmSession)});
}
return session;
}
@@ -64,7 +65,8 @@
tmpEncryptedMessage.data(),
encryptedMessage.size())) {
throw std::runtime_error(
- "error createInbound => ::olm_create_inbound_session");
+ "error createInbound => " +
+ std::string{::olm_session_last_error(session->olmSession)});
}
return session;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 8, 5:37 PM (5 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2820779
Default Alt Text
D8114.id27648.diff (3 KB)
Attached To
Mode
D8114: Provided detailed error messages on olm functions failures in CryptoModule
Attached
Detach File
Event Timeline
Log In to Comment