ObjFW  Diff

Differences From Artifact [d023c56c3e]:

To Artifact [77fce54f87]:

  • File src/exceptions/OFException.m — part of check-in [e1e7ffa903] at 2011-09-22 23:25:42 on branch trunk — Exceptions are now autoreleased.

    This is safe as an "exception loop" can't happen, since if allocating
    an exception fails, it throws an OFAllocFailedException which is
    preallocated and can always be thrown.

    So, the worst case would be that an autorelease of an exception fails,
    triggering an OFOutOfMemoryException for which there is no memory,
    resulting in an OFAllocFailedException to be thrown. (user: js, size: 1175) [annotate] [blame] [check-ins using]


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

#import "OFException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFException
+ newWithClass: (Class)class_
{
	return [[self alloc] initWithClass: class_];
}

- init
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException newWithClass: c
					      selector: _cmd];
}

- initWithClass: (Class)class_
{
	self = [super init];

	inClass = class_;







|

|






|
|







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

#import "OFException.h"
#import "OFString.h"

#import "OFNotImplementedException.h"

@implementation OFException
+ exceptionWithClass: (Class)class_
{
	return [[[self alloc] initWithClass: class_] autorelease];
}

- init
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

- initWithClass: (Class)class_
{
	self = [super init];

	inClass = class_;
56
57
58
59
60
61
62
63
64
65
66
67
68
69
	return inClass;
}

- (OFString*)description
{
	return @"An exception occurred";
}

- autorelease
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}
@end







<
<
<
<
<
<

56
57
58
59
60
61
62






63
	return inClass;
}

- (OFString*)description
{
	return @"An exception occurred";
}






@end