ObjFW  Diff

Differences From Artifact [aa189c31b8]:

To Artifact [a8b41d395b]:

  • File src/exceptions/OFException.h — 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: 1466) [annotate] [blame] [check-ins using]


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
@class OFString;

/**
 * \brief The base class for all exceptions in ObjFW
 *
 * The OFException class is the base class for all exceptions in ObjFW, except
 * the OFAllocFailedException.
 *
 * IMPORTANT: Exceptions do NOT use OFAutoreleasePools and can't be autoreleased
 * either! You have to make sure to dealloc the exception in your \@catch block!
 */
@interface OFException: OFObject
{
	Class inClass;
	OFString *description;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) Class inClass;
#endif

/**
 * Creates a new exception.
 *
 * \param class_ The class of the object which caused the exception
 * \return A new exception
 */
+ newWithClass: (Class)class_;

/**
 * Initializes an already allocated OFException.
 *
 * \param class_ The class of the object which caused the exception
 * \return An initialized OFException
 */







<
<
<

















|







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
@class OFString;

/**
 * \brief The base class for all exceptions in ObjFW
 *
 * The OFException class is the base class for all exceptions in ObjFW, except
 * the OFAllocFailedException.



 */
@interface OFException: OFObject
{
	Class inClass;
	OFString *description;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, nonatomic) Class inClass;
#endif

/**
 * Creates a new exception.
 *
 * \param class_ The class of the object which caused the exception
 * \return A new exception
 */
+ exceptionWithClass: (Class)class_;

/**
 * Initializes an already allocated OFException.
 *
 * \param class_ The class of the object which caused the exception
 * \return An initialized OFException
 */