ObjFW  Artifact [a50325ba8b]

Artifact a50325ba8bc96575bbf9148acff6c5dfee623db8833eb18e0fc1caf3fbf16a8e:


/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFString;
@class OFArray;
@class OFMutableArray;

/*!
 * @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;
	void *_returnAddresses[32];
}

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

/*!
 * @brief Creates a new, autoreleased exception.
 *
 * @param class_ The class of the object which caused the exception
 * @return A new, autoreleased exception
 */
+ (instancetype)exceptionWithClass: (Class)class_;

/*!
 * @brief Initializes an already allocated OFException.
 *
 * @param class_ The class of the object which caused the exception
 * @return An initialized OFException
 */
- initWithClass: (Class)class_;

/*!
 * @brief Returns the class of the object in which the exception occurred.
 *
 * @return The class of the object in which the exception occurred
 */
- (Class)inClass;

/*!
 * @brief Returns a description of the exception.
 *
 * @return A description of the exception
 */
- (OFString*)description;

/*!
 * @brief Returns a backtrace of when the exception was created or nil if no
 *	  backtrace is available.
 *
 * @return A backtrace of when the exception was created
 */
- (OFArray*)backtrace;
@end