mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/loggingAndAsserts'
This commit is contained in:
commit
6a2e00928c
18
Podfile.lock
18
Podfile.lock
|
@ -25,9 +25,11 @@ PODS:
|
|||
- CocoaLumberjack/Default (3.4.2)
|
||||
- CocoaLumberjack/Extensions (3.4.2):
|
||||
- CocoaLumberjack/Default
|
||||
- Curve25519Kit (2.1.0)
|
||||
- Curve25519Kit (2.1.0):
|
||||
- CocoaLumberjack
|
||||
- GRKOpenSSLFramework (1.0.2.12)
|
||||
- HKDFKit (0.0.4)
|
||||
- HKDFKit (0.0.4):
|
||||
- CocoaLumberjack
|
||||
- libPhoneNumber-iOS (0.9.13)
|
||||
- Mantle (2.1.0):
|
||||
- Mantle/extobjc (= 2.1.0)
|
||||
|
@ -202,16 +204,16 @@ EXTERNAL SOURCES:
|
|||
|
||||
CHECKOUT OPTIONS:
|
||||
AxolotlKit:
|
||||
:commit: 0c9dc8cc0f02fd616fa8e5a4f4184e452de93f1e
|
||||
:commit: c058f3bdf4e11f378d3232b0031526c7611c20e0
|
||||
:git: https://github.com/signalapp/SignalProtocolKit.git
|
||||
Curve25519Kit:
|
||||
:commit: ced146699622ebd3d282bbfce3d492db4456e9aa
|
||||
:commit: 14bfa06578b6f68aa1ee09ecc9e16ad751e0ebd2
|
||||
:git: https://github.com/signalapp/Curve25519Kit
|
||||
GRKOpenSSLFramework:
|
||||
:commit: b799c27e7927e5304ec1e4ad53c6d33c6fd1cae7
|
||||
:git: https://github.com/signalapp/GRKOpenSSLFramework
|
||||
HKDFKit:
|
||||
:commit: 780f980b8ff3c4a24baf19088162f13605c0b272
|
||||
:commit: f6e051a765e0bc819fee72f9b7d18acee33a8b37
|
||||
:git: https://github.com/signalapp/HKDFKit.git
|
||||
SocketRocket:
|
||||
:commit: 9f9563a83cd8960503074aa8de72206f83fb7a69
|
||||
|
@ -225,11 +227,11 @@ CHECKOUT OPTIONS:
|
|||
|
||||
SPEC CHECKSUMS:
|
||||
AFNetworking: b6f891fdfaed196b46c7a83cf209e09697b94057
|
||||
AxolotlKit: 07bd978ea931d113939de88d3d2d354896680ceb
|
||||
AxolotlKit: 3a8d57041c5b162425cc40773ea6276c0c838c9d
|
||||
CocoaLumberjack: db7cc9e464771f12054c22ff6947c5a58d43a0fd
|
||||
Curve25519Kit: 76d0859ecb34704f7732847812363f83b23a6a59
|
||||
Curve25519Kit: d4741ff66e7d92b70316e72476ea1f91495ab51b
|
||||
GRKOpenSSLFramework: 8a3735ad41e7dc1daff460467bccd32ca5d6ae3e
|
||||
HKDFKit: 3fb424060aaf69795bc8ab34c4c233b98dc6303b
|
||||
HKDFKit: 0445c3158e15137c845bee690a59755ac4360469
|
||||
libPhoneNumber-iOS: e444379ac18bbfbdefad571da735b2cd7e096caa
|
||||
Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b
|
||||
PromiseKit: 743e497a5f505a470d3bbbf4ce0663c1268af0a4
|
||||
|
|
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit b53c22b34fb03c898ed5d4360a3941ba93a232f9
|
||||
Subproject commit 3ce7a1b597cd20211b2e9ad79ad59262b6f64c82
|
|
@ -490,7 +490,6 @@
|
|||
B660F6BB1C29868000687D6E /* OWSContactsManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6761C29867F00687D6E /* OWSContactsManagerTest.m */; };
|
||||
B660F6D21C29868000687D6E /* PushManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F69C1C29868000687D6E /* PushManagerTest.m */; };
|
||||
B660F6D41C29868000687D6E /* whisperFake.cer in Resources */ = {isa = PBXBuildFile; fileRef = B660F69F1C29868000687D6E /* whisperFake.cer */; };
|
||||
B660F6DA1C29868000687D6E /* ExceptionsTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6AB1C29868000687D6E /* ExceptionsTest.m */; };
|
||||
B660F6DB1C29868000687D6E /* FunctionalUtilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */; };
|
||||
B660F6E01C29868000687D6E /* UtilTest.m in Sources */ = {isa = PBXBuildFile; fileRef = B660F6B41C29868000687D6E /* UtilTest.m */; };
|
||||
B660F7561C29988E00687D6E /* PushManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B6B9ECFB198B31BA00C620D3 /* PushManager.m */; };
|
||||
|
@ -1197,8 +1196,6 @@
|
|||
B660F69E1C29868000687D6E /* SignalTests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SignalTests-Info.plist"; sourceTree = "<group>"; };
|
||||
B660F69F1C29868000687D6E /* whisperFake.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = whisperFake.cer; sourceTree = "<group>"; };
|
||||
B660F6A01C29868000687D6E /* TestUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestUtil.h; sourceTree = "<group>"; };
|
||||
B660F6AA1C29868000687D6E /* ExceptionsTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionsTest.h; sourceTree = "<group>"; };
|
||||
B660F6AB1C29868000687D6E /* ExceptionsTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExceptionsTest.m; sourceTree = "<group>"; };
|
||||
B660F6AC1C29868000687D6E /* FunctionalUtilTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionalUtilTest.h; sourceTree = "<group>"; };
|
||||
B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtilTest.m; sourceTree = "<group>"; };
|
||||
B660F6B31C29868000687D6E /* UtilTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilTest.h; sourceTree = "<group>"; };
|
||||
|
@ -2368,8 +2365,6 @@
|
|||
3421981B21061D2E00C57195 /* ByteParserTest.swift */,
|
||||
3491D9A021022DB7001EF5A1 /* CDSSigningCertificateTest.m */,
|
||||
45E7A6A61E71CA7E00D44FB5 /* DisplayableTextFilterTest.swift */,
|
||||
B660F6AA1C29868000687D6E /* ExceptionsTest.h */,
|
||||
B660F6AB1C29868000687D6E /* ExceptionsTest.m */,
|
||||
B660F6AC1C29868000687D6E /* FunctionalUtilTest.h */,
|
||||
B660F6AD1C29868000687D6E /* FunctionalUtilTest.m */,
|
||||
455AC69D1F4F8B0300134004 /* ImageCacheTest.swift */,
|
||||
|
@ -3485,7 +3480,6 @@
|
|||
954AEE6A1DF33E01002E5410 /* ContactsPickerTest.swift in Sources */,
|
||||
45666F581D9B2880008FE134 /* OWSScrubbingLogFormatterTest.m in Sources */,
|
||||
B660F6E01C29868000687D6E /* UtilTest.m in Sources */,
|
||||
B660F6DA1C29868000687D6E /* ExceptionsTest.m in Sources */,
|
||||
4C3EF7FD2107DDEE0007EBF7 /* ParamParserTest.swift in Sources */,
|
||||
B660F6DB1C29868000687D6E /* FunctionalUtilTest.m in Sources */,
|
||||
45E7A6A81E71CA7E00D44FB5 /* DisplayableTextFilterTest.swift in Sources */,
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
#endif
|
||||
|
||||
#import <SignalServiceKit/OWSAsserts.h>
|
||||
#import <SignalServiceKit/Constraints.h>
|
||||
#import <SignalServiceKit/OWSAnalytics.h>
|
||||
#import <SignalServiceKit/OWSDispatch.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
#import <SignalServiceKit/NSObject+OWS.h>
|
||||
#endif
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#import <SignalServiceKit/TSDatabaseView.h>
|
||||
#import <SignalServiceKit/TSPreKeyManager.h>
|
||||
#import <SignalServiceKit/TSSocketManager.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
#import <YapDatabase/YapDatabaseCryptoUtils.h>
|
||||
#import <sys/sysctl.h>
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ExceptionsTest.h"
|
||||
#import "TestUtil.h"
|
||||
|
||||
@implementation ExceptionsTest
|
||||
|
||||
- (void)testContracts {
|
||||
ows_require(1 + 1 == 2);
|
||||
@try {
|
||||
ows_require(1 + 1 == 3);
|
||||
XCTFail(@"");
|
||||
} @catch (BadArgument *ex) {
|
||||
test([[ex reason] hasPrefix:@"require 1 + 1 == 3"]);
|
||||
}
|
||||
|
||||
requireState(1 + 1 == 2);
|
||||
@try {
|
||||
requireState(1 + 1 == 3);
|
||||
XCTFail(@"");
|
||||
} @catch (BadState *ex) {
|
||||
test([[ex reason] hasPrefix:@"required state: 1 + 1 == 3"]);
|
||||
}
|
||||
|
||||
checkOperationDescribe(1 + 1 == 2, @"addition.");
|
||||
@try {
|
||||
checkOperationDescribe(1 + 1 == 3, @"addition.");
|
||||
XCTFail(@"");
|
||||
} @catch (OperationFailed *ex) {
|
||||
test([[ex reason] hasPrefix:@"Operation failed: addition. Expected: 1 + 1 == 3"]);
|
||||
}
|
||||
|
||||
checkOperation(1 + 1 == 2);
|
||||
@try {
|
||||
checkOperation(1 + 1 == 3);
|
||||
XCTFail(@"");
|
||||
} @catch (OperationFailed *ex) {
|
||||
test([[ex reason] hasPrefix:@"Operation failed. Expected: 1 + 1 == 3"]);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
|
@ -16,10 +16,6 @@
|
|||
#endif
|
||||
|
||||
#import <SignalServiceKit/OWSAsserts.h>
|
||||
#import <SignalServiceKit/Constraints.h>
|
||||
#import <SignalServiceKit/OWSAnalytics.h>
|
||||
#import <SignalServiceKit/OWSDispatch.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
#import <SignalServiceKit/NSObject+OWS.h>
|
||||
#import <SignalServiceKit/NSString+SSK.h>
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#import "UIFont+OWS.h"
|
||||
#import "UIView+OWS.h"
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/OWSDispatch.h>
|
||||
#import <SignalServiceKit/OWSError.h>
|
||||
#import <SignalServiceKit/OWSMessageSender.h>
|
||||
#import <SignalServiceKit/TSThread.h>
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#import "UIView+OWS.h"
|
||||
#import "OWSMath.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UIViewController+OWS.h"
|
||||
#import "UIColor+OWS.h"
|
||||
#import "UIView+OWS.h"
|
||||
#import "UIViewController+OWS.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#import <SignalServiceKit/OWSPrimaryStorage.h>
|
||||
#import <SignalServiceKit/PhoneNumber.h>
|
||||
#import <SignalServiceKit/SignalAccount.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
|
||||
@import Contacts;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#import "MIMETypeUtil.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "OWSBackgroundTask.h"
|
||||
#import "OWSDispatch.h"
|
||||
#import "OWSError.h"
|
||||
#import "OWSPrimaryStorage.h"
|
||||
#import "OWSRequestFactory.h"
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#import "TSAttachment.h"
|
||||
#import "MIMETypeUtil.h"
|
||||
#import "NSString+SSK.h"
|
||||
#import "iOSVersions.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#import "OWSContact.h"
|
||||
#import "OWSDevice.h"
|
||||
#import "OWSDisappearingMessagesJob.h"
|
||||
#import "OWSDispatch.h"
|
||||
#import "OWSError.h"
|
||||
#import "OWSIdentityManager.h"
|
||||
#import "OWSMessageServiceParams.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#import "MIMETypeUtil.h"
|
||||
#import "NSError+MessageSending.h"
|
||||
#import "NSNotificationCenter+OWS.h"
|
||||
#import "OWSDispatch.h"
|
||||
#import "OWSError.h"
|
||||
#import "OWSOperation.h"
|
||||
#import "OWSRequestFactory.h"
|
||||
|
|
|
@ -11,30 +11,6 @@ static const NSUInteger ddLogLevel = DDLogLevelAll;
|
|||
#else
|
||||
static const NSUInteger ddLogLevel = DDLogLevelInfo;
|
||||
#endif
|
||||
#import "Constraints.h"
|
||||
#import "NSObject+OWS.h"
|
||||
#import "OWSAnalytics.h"
|
||||
#import "OWSAsserts.h"
|
||||
#import "OWSDispatch.h"
|
||||
#import "iOSVersions.h"
|
||||
|
||||
#define BLOCK_SAFE_RUN(block, ...) \
|
||||
block ? dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), \
|
||||
^{ \
|
||||
block(__VA_ARGS__); \
|
||||
}) \
|
||||
: nil
|
||||
#define SYNC_BLOCK_SAFE_RUN(block, ...) block ? block(__VA_ARGS__) : nil
|
||||
|
||||
#define MacrosSingletonImplemention \
|
||||
+(instancetype)sharedInstance { \
|
||||
static dispatch_once_t onceToken; \
|
||||
static id sharedInstance = nil; \
|
||||
dispatch_once(&onceToken, ^{ \
|
||||
sharedInstance = [self.class new]; \
|
||||
}); \
|
||||
\
|
||||
return sharedInstance; \
|
||||
}
|
||||
|
||||
#define MacrosSingletonInterface +(instancetype)sharedInstance;
|
||||
|
|
|
@ -178,7 +178,10 @@ const NSUInteger kAES256_KeyByteLength = 32;
|
|||
}
|
||||
uint32_t dataLength = (uint32_t)stringData.length;
|
||||
|
||||
NSMutableData *hashData = [NSMutableData dataWithLength:20];
|
||||
NSMutableData *_Nullable hashData = [NSMutableData dataWithLength:20];
|
||||
if (!hashData) {
|
||||
OWSFail(@"Could not allocate buffer.");
|
||||
}
|
||||
CC_SHA1(stringData.bytes, dataLength, hashData.mutableBytes);
|
||||
|
||||
NSData *truncatedData = [hashData subdataWithRange:NSMakeRange(0, 10)];
|
||||
|
@ -532,8 +535,7 @@ const NSUInteger kAES256_KeyByteLength = 32;
|
|||
ows_add_overflow(paddedAttachmentData.length, kCCBlockSizeAES128, &bufferSize);
|
||||
NSMutableData *_Nullable bufferData = [NSMutableData dataWithLength:bufferSize];
|
||||
if (!bufferData) {
|
||||
OWSLogError(@"Failed to allocate buffer.");
|
||||
return nil;
|
||||
OWSFail(@"Failed to allocate buffer.");
|
||||
}
|
||||
|
||||
size_t bytesEncrypted = 0;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#import "NSData+Image.h"
|
||||
#import "NSString+SSK.h"
|
||||
#import "OWSFileSystem.h"
|
||||
#import "iOSVersions.h"
|
||||
#import <SignalServiceKit/SignalServiceKit-Swift.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import <AxolotlKit/NSData+SPK.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSData (OWS)
|
||||
|
||||
/**
|
||||
* Compares data in constant time so as to help avoid potential timing attacks.
|
||||
*/
|
||||
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other;
|
||||
|
||||
- (NSData *)dataByAppendingData:(NSData *)data;
|
||||
|
||||
- (NSString *)hexadecimalString;
|
||||
|
|
|
@ -8,25 +8,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@implementation NSData (OWS)
|
||||
|
||||
- (BOOL)ows_constantTimeIsEqualToData:(NSData *)other
|
||||
{
|
||||
volatile UInt8 isEqual = 0;
|
||||
|
||||
if (self.length != other.length) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
UInt8 *leftBytes = (UInt8 *)self.bytes;
|
||||
UInt8 *rightBytes = (UInt8 *)other.bytes;
|
||||
for (int i = 0; i < self.length; i++) {
|
||||
// rather than returning as soon as we find a discrepency, we compare the rest of
|
||||
// the byte stream to maintain a constant time comparison
|
||||
isEqual |= leftBytes[i] ^ rightBytes[i];
|
||||
}
|
||||
|
||||
return isEqual == 0;
|
||||
}
|
||||
|
||||
- (NSData *)dataByAppendingData:(NSData *)data
|
||||
{
|
||||
NSMutableData *result = [self mutableCopy];
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
#import "NSString+SSK.h"
|
||||
#import "iOSVersions.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@import CocoaLumberjack;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
static inline BOOL ShouldLogVerbose()
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@interface BadArgument : NSException
|
||||
+(BadArgument*) new:(NSString*)reason;
|
||||
+(void)raise:(NSString *)message;
|
||||
@end
|
|
@ -1,10 +0,0 @@
|
|||
#import "BadArgument.h"
|
||||
|
||||
@implementation BadArgument
|
||||
+(BadArgument*) new:(NSString*)reason {
|
||||
return [[BadArgument alloc] initWithName:@"Invalid Argument" reason:reason userInfo:nil];
|
||||
}
|
||||
+(void)raise:(NSString *)message {
|
||||
[BadArgument raise:@"Invalid Argument" format:@"%@", message];
|
||||
}
|
||||
@end
|
|
@ -1,7 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@interface BadState : NSException
|
||||
+(void)raise:(NSString *)message;
|
||||
@end
|
|
@ -1,11 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BadState.h"
|
||||
|
||||
@implementation BadState
|
||||
+(void)raise:(NSString *)message {
|
||||
[BadState raise:@"Invalid State" format:@"%@", message];
|
||||
}
|
||||
@end
|
|
@ -1,45 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "BadArgument.h"
|
||||
#import "BadState.h"
|
||||
#import "OperationFailed.h"
|
||||
#import <CocoaLumberjack/CocoaLumberjack.h>
|
||||
|
||||
/// 'require(X)' is used to indicate parameter-related preconditions that callers must satisfy.
|
||||
/// Failure to satisfy indicates a bug in the caller.
|
||||
#define ows_require(expr) \
|
||||
if (!(expr)) { \
|
||||
NSString *reason = \
|
||||
[NSString stringWithFormat:@"require %@ (in %s at line %d)", (@ #expr), __FILE__, __LINE__]; \
|
||||
OWSLogError(@"%@", reason); \
|
||||
[BadArgument raise:reason]; \
|
||||
};
|
||||
|
||||
/// 'requireState(X)' is used to indicate callee-state-related preconditions that callers must satisfy.
|
||||
/// Failure to satisfy indicates a stateful bug in either the caller or the callee.
|
||||
#define requireState(expr) \
|
||||
if (!(expr)) \
|
||||
[BadState raise:[NSString stringWithFormat:@"required state: %@ (in %s at line %d)", (@ #expr), __FILE__, __LINE__]]
|
||||
|
||||
/// 'checkOperation(X)' is used to throw exceptions if operations fail.
|
||||
/// Failure does not indicate a bug.
|
||||
/// Methods may throw these exceptions for callers to catch as a 'returned error' result.
|
||||
#define checkOperation(expr) \
|
||||
if (!(expr)) { \
|
||||
NSString *reason = [NSString \
|
||||
stringWithFormat:@"Operation failed. Expected: %@(in %s at line %d)", (@ #expr), __FILE__, __LINE__]; \
|
||||
[OperationFailed raise:reason]; \
|
||||
}
|
||||
|
||||
/// 'checkOperationDescribe(X, Desc)' is used to throw exceptions if operations fail, and describe the problem.
|
||||
/// Failure does not indicate a bug.
|
||||
/// Methods may throw these exceptions for callers to catch as a 'returned error' result.
|
||||
#define checkOperationDescribe(expr, desc) \
|
||||
if (!(expr)) \
|
||||
[OperationFailed raise:[NSString stringWithFormat:@"Operation failed: %@ Expected: %@(in %s at line %d)", \
|
||||
(desc), \
|
||||
(@ #expr), \
|
||||
__FILE__, \
|
||||
__LINE__]]
|
|
@ -1,8 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
@interface OperationFailed : NSException
|
||||
+(OperationFailed*) new:(NSString*)reason;
|
||||
+(void)raise:(NSString *)message;
|
||||
@end
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OperationFailed.h"
|
||||
|
||||
@implementation OperationFailed
|
||||
+(OperationFailed*) new:(NSString*)reason {
|
||||
return [[OperationFailed alloc] initWithName:@"Operation failed" reason:reason userInfo:nil];
|
||||
}
|
||||
+(void)raise:(NSString *)message {
|
||||
[OperationFailed raise:@"Operation failed" format:@"%@", message];
|
||||
}
|
||||
@end
|
|
@ -16,9 +16,6 @@
|
|||
#endif
|
||||
|
||||
#import <SignalServiceKit/OWSAsserts.h>
|
||||
#import <SignalServiceKit/Constraints.h>
|
||||
#import <SignalServiceKit/OWSAnalytics.h>
|
||||
#import <SignalServiceKit/OWSDispatch.h>
|
||||
#import <SignalServiceKit/iOSVersions.h>
|
||||
#import <SignalServiceKit/NSObject+OWS.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue