From: Michael Wallner Date: Fri, 3 Mar 2006 20:19:45 +0000 (+0000) Subject: - methods that return an object should throw an exception on failure (tm) X-Git-Tag: RELEASE_1_0_0RC1~15 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=6a2944938aa39f9f4471fba348a6ab6ea5473b2b;p=m6w6%2Fext-http - methods that return an object should throw an exception on failure (tm) HttpMessage::getParentMessage() throws HttpMessageException if there's no parent message --- diff --git a/http_message_object.c b/http_message_object.c index 4cb201a..c0f5bf0 100644 --- a/http_message_object.c +++ b/http_message_object.c @@ -1127,20 +1127,22 @@ PHP_METHOD(HttpMessage, setHttpVersion) * Get parent Message. * * Returns the parent HttpMessage on success, or NULL if there's none. + * + * Throws HttpMessageException. */ PHP_METHOD(HttpMessage, getParentMessage) { - NO_ARGS; - - IF_RETVAL_USED { + SET_EH_THROW_HTTP(); + NO_ARGS { getObject(http_message_object, obj); if (obj->message->parent) { RETVAL_OBJVAL(obj->parent, 1); } else { - RETVAL_NULL(); + http_error(HE_WARNING, HTTP_E_MESSAGE, "HttpMessage does not have a parent message"); } } + SET_EH_NORMAL(); } /* }}} */