FAQ
Hey guys,

Another n00b question: What is the proper way to return from a function
after throwing an exception? My code looks like:

zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
blah", 0 TSRMLS_CC);
return;

Should I instead RETURN_FALSE from there?

Thanks,
Pieter

Search Discussions

  • Alexey Zakhlestin at Jun 10, 2010 at 7:54 pm

    On 10.06.2010, at 23:41, Pieter de Zwart wrote:

    Hey guys,

    Another n00b question: What is the proper way to return from a function
    after throwing an exception? My code looks like:

    zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
    blah", 0 TSRMLS_CC);
    return;

    Should I instead RETURN_FALSE from there?
    It doesn't really matter, as return value will never be checked.
    "return" should be enough


    --
    Alexey Zakhlestin
    http://www.milkfarmsoft.com/
  • Daniel Convissor at Jun 11, 2010 at 5:24 pm
    Hi Pieter:
    On Thu, Jun 10, 2010 at 12:41:29PM -0700, Pieter de Zwart wrote:

    zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
    blah", 0 TSRMLS_CC);
    return;
    These kinds of questions (regarding how to use PHP) should be asked on
    the php-general list. The internals list you wrote to is for discussions
    of how to make PHP.

    Anyway, the "return" line in your code can never be reached, so should
    not be there at all.

    --Dan

    --
    T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
    data intensive web and database programming
    http://www.AnalysisAndSolutions.com/
    4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
  • Hannes Magnusson at Jun 11, 2010 at 5:34 pm

    On Fri, Jun 11, 2010 at 19:24, Daniel Convissor wrote:
    Hi Pieter:
    On Thu, Jun 10, 2010 at 12:41:29PM -0700, Pieter de Zwart wrote:

    zend_throw_exception(amqp_connection_exception_class_entry, "blah blah
    blah", 0 TSRMLS_CC);
    return;
    These kinds of questions (regarding how to use PHP) should be asked on
    the php-general list.  The internals list you wrote to is for discussions
    of how to make PHP.
    Which part of "zend_throw_exception()" sounds like a php-general@ question?

    I think you misread his question :)

    -Hannes
  • Daniel Convissor at Jun 12, 2010 at 2:34 pm
    Hi Hannes:
    On Fri, Jun 11, 2010 at 07:34:54PM +0200, Hannes Magnusson wrote:

    Which part of "zend_throw_exception()" sounds like a php-general@ question?
    DOH!

    --Dan

    --
    T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
    data intensive web and database programming
    http://www.AnalysisAndSolutions.com/
    4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedJun 10, '10 at 7:42p
activeJun 12, '10 at 2:34p
posts5
users4
websitephp.net

People

Translate

site design / logo © 2022 Grokbase