+ Reply to Thread
Results 1 to 2 of 2

Thread: PHP try-catch and AMFPHP

  1. Join Date
    Aug 2009
    Posts
    1

    PHP try-catch and AMFPHP

    Hi there,

    I'm working on a method in PHP on which I use try/catch but amfphp doesn't return the appropiate message when I get into the catch block.

    For example:

    PHP Code:
    class TestPhp{

    function 
    TestPhp(){}

    function 
    MyMethod(){
    try{
           
    $success call-something...
    }catch (
    Exception e){
           
    $errorMessage "you messed up";
           
    message return

    return 
    $success;

    I tried with throw and with return on the catch block to get the error message but nothing worked... Any advice?

    The amfphp browser keeps telling me this TypeError: Error #1009:

    Thanks in advance.

    Bye.

  2. Join Date
    Aug 2009
    Age
    56
    Posts
    3
    If you get rid of all the syntax errors in your php it should work.
    In particular the following works for me.

    class TestPhp{

    function
    MyMethod(){

    try
    {
    $success = $rubbish->$nonsense/0;
    }
    catch (Exception $e){
    $errorMessage = "you messed up";
    return $errorMessage;
    }

    return
    $success;

    }

    }

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts