14
15
16
17
18
19
20
21
|
*/
#include "config.h"
#import "OTAssertionFailedException.h"
@implementation OTAssertionFailedException
@end
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
*/
#include "config.h"
#import "OTAssertionFailedException.h"
@implementation OTAssertionFailedException
@synthesize condition = _condition, message = _message;
+ (instancetype)exceptionWithCondition: (OFString *)condition
message: (OFString *)message
{
return [[[self alloc] initWithCondition: condition
message: message] autorelease];
}
+ (instancetype)exception
{
OF_UNRECOGNIZED_SELECTOR
}
- (instancetype)initWithCondition: (OFString *)condition
message: (OFString *)message
{
self = [super init];
@try {
_condition = [condition copy];
_message = [message copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (void)dealloc
{
[_condition release];
[_message release];
[super dealloc];
}
- (OFString *)description
{
if (_message != nil)
return [OFString stringWithFormat: @"Assertion failed: %@: %@",
_condition, _message];
else
return [OFString stringWithFormat: @"Assertion failed: %@",
_condition];
}
@end
|