From aa12cbcac2d9f380847644febdf1f13f102cebb1 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 24 Nov 2016 11:45:59 +0100 Subject: OLMKit: Make returned NSError provide the raw olm error string (ex:"UNKNOWN_MESSAGE_INDEX") in their NSLocalizedDescriptionKey. NSLocalizedFailureReasonErrorKey can contain more contextual information. --- xcode/OLMKit/OLMSession.m | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xcode/OLMKit/OLMSession.m') diff --git a/xcode/OLMKit/OLMSession.m b/xcode/OLMKit/OLMSession.m index 3801e08..7cbd358 100644 --- a/xcode/OLMKit/OLMSession.m +++ b/xcode/OLMKit/OLMSession.m @@ -88,7 +88,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_create_outbound_session error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_create_outbound_session error: %@", errorString] }]; } @@ -114,7 +115,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_create_inbound_session error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_create_inbound_session error: %@", errorString] }]; } @@ -141,7 +143,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_create_inbound_session_from error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_create_inbound_session_from error: %@", errorString] }]; } @@ -222,7 +225,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_encrypt error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_encrypt error: %@", errorString] }]; } @@ -251,7 +255,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_decrypt_max_plaintext_length error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_decrypt_max_plaintext_length error: %@", errorString] }]; } @@ -271,7 +276,8 @@ *error = [NSError errorWithDomain:OLMErrorDomain code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"olm_decrypt error: %@", errorString] + NSLocalizedDescriptionKey: errorString, + NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"olm_decrypt error: %@", errorString] }]; } -- cgit v1.2.3