@@ -18,28 +18,30 @@ #import "OFSetOptionFailedException.h" #import "OFString.h" #import "OFStream.h" -#import "common.h" - @implementation OFSetOptionFailedException + (instancetype)exceptionWithStream: (OFStream*)stream + errNo: (int)errNo { - return [[[self alloc] initWithStream: stream] autorelease]; + return [[[self alloc] initWithStream: stream + errNo: errNo] autorelease]; } - init { OF_INVALID_INIT_METHOD } - initWithStream: (OFStream*)stream + errNo: (int)errNo { self = [super init]; _stream = [stream retain]; + _errNo = errNo; return self; } - (void)dealloc @@ -50,14 +52,19 @@ } - (OFString*)description { return [OFString stringWithFormat: - @"Setting an option in a stream of type %@ failed!", - [_stream class]]; + @"Setting an option in a stream of type %@ failed: %@", + [_stream class], of_strerror(_errNo)]; } - (OFStream*)stream { OF_GETTER(_stream, true) } + +- (int)errNo +{ + return _errNo; +} @end