@@ -14,36 +14,42 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" + +#include #import "OFConditionWaitFailedException.h" #import "OFString.h" #import "OFCondition.h" @implementation OFConditionWaitFailedException -@synthesize condition = _condition; +@synthesize condition = _condition, errNo = _errNo; + (instancetype)exceptionWithCondition: (OFCondition *)condition + errNo: (int)errNo { - return [[[self alloc] initWithCondition: condition] autorelease]; -} - -- (instancetype)init -{ - return [self initWithCondition: nil]; + return [[[self alloc] initWithCondition: condition + errNo: errNo] autorelease]; } - (instancetype)initWithCondition: (OFCondition *)condition + errNo: (int)errNo { self = [super init]; _condition = [condition retain]; + _errNo = errNo; return self; } + +- (instancetype)init +{ + OF_INVALID_INIT_METHOD +} - (void)dealloc { [_condition release]; @@ -50,13 +56,10 @@ [super dealloc]; } - (OFString *)description { - if (_condition != nil) - return [OFString stringWithFormat: - @"Waiting for a condition of type %@ failed!", - _condition.class]; - else - return @"Waiting for a condition failed!"; + return [OFString stringWithFormat: + @"Waiting for a condition of type %@ failed: %s", + _condition.class, strerror(_errNo)]; } @end