@@ -10,35 +10,90 @@ */ #import #import "OFObject.h" -// FIXME: Exceptions should include which type of error occoured (fopen etc.) +/* FIXME: Exceptions should include which type of error occoured (fopen etc.) */ +/** + * The OFException class is the base class for all exceptions in ObjFW. + */ @interface OFException: OFObject { id object; char *string; } +/** + * Creates a new exception. + * + * \param obj The object which caused the exception + * \return A new exception + */ + newWithObject: (id)obj; + +/** + * Initializes an already allocated OFException. + * + * \param obj The object which caused the exception + * \return An initialized OFException + */ - initWithObject: (id)obj; + +/** + * Frees an OFException and the memory it allocated. + */ - free; + +/** + * Raises an OFException and aborts execution if the exception is not caught. + */ + - raise; + +/** + * \return An error message for the exception as a C String + */ - (char*)cString; @end +/** + * An OFException indicating there is not enough memory available. + */ @interface OFNoMemException: OFException { size_t req_size; } +/** + * Creates a new no memory exception. + * + * \param obj The object which caused the exception + * \param size The size of the memory that couldn't be allocated + * \return A new no memory exception + */ + newWithObject: (id)obj andSize: (size_t)size; + +/** + * Initializes an already allocated no memory exception. + * + * \param obj The object which caused the exception + * \param size The size of the memory that couldn't be allocated + * \return An initialized new no memory exception + */ - initWithObject: (id)obj andSize: (size_t)size; + +/** + * \return An error message for the exception as a C String + */ - (char*)cString; + +/** + * \return The size of the memoory that couldn't be allocated + */ - (size_t)requestedSize; @end @interface OFNotImplementedException: OFException {