Index: src/exceptions/OFLockFailedException.h ================================================================== --- src/exceptions/OFLockFailedException.h +++ src/exceptions/OFLockFailedException.h @@ -48,21 +48,17 @@ * @return A new, autoreleased lock failed exception */ + (instancetype)exceptionWithLock: (nullable id )lock errNo: (int)errNo; -+ (instancetype)exception OF_UNAVAILABLE; - /** * @brief Initializes an already allocated lock failed exception. * * @param lock The lock which could not be locked * @param errNo The errno of the error that occurred * @return An initialized lock failed exception */ - (instancetype)initWithLock: (nullable id )lock errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - -- (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -26,15 +26,10 @@ + (instancetype)exceptionWithLock: (id )lock errNo: (int)errNo { return [[[self alloc] initWithLock: lock errNo: errNo] autorelease]; } -+ (instancetype)exception -{ - OF_UNRECOGNIZED_SELECTOR -} - - (instancetype)initWithLock: (id )lock errNo: (int)errNo { self = [super init]; _lock = [lock retain]; @@ -41,24 +36,22 @@ _errNo = errNo; return self; } -- (instancetype)init -{ - OF_INVALID_INIT_METHOD -} - - (void)dealloc { [_lock release]; [super dealloc]; } - (OFString *)description { - return [OFString stringWithFormat: - @"A lock of type %@ could not be locked: %s", - [_lock class], strerror(_errNo)]; + if (_lock != nil) + return [OFString stringWithFormat: + @"A lock of type %@ could not be locked: %s", + [_lock class], strerror(_errNo)]; + else + return @"A lock could not be locked!"; } @end Index: src/exceptions/OFUnlockFailedException.h ================================================================== --- src/exceptions/OFUnlockFailedException.h +++ src/exceptions/OFUnlockFailedException.h @@ -57,10 +57,8 @@ * @param errNo The errno of the error that occurred * @return An initialized unlock failed exception */ - (instancetype)initWithLock: (nullable id )lock errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - -- (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -36,24 +36,22 @@ _errNo = errNo; return self; } -- (instancetype)init -{ - OF_INVALID_INIT_METHOD -} - - (void)dealloc { [_lock release]; [super dealloc]; } - (OFString *)description { - return [OFString stringWithFormat: - @"A lock of type %@ could not be unlocked: %s", - [_lock class], strerror(_errNo)]; + if (_lock != nil) + return [OFString stringWithFormat: + @"A lock of type %@ could not be unlocked: %s", + [_lock class], strerror(_errNo)]; + else + return @"A lock could not be unlocked!"; } @end