Error capturing not working

evil_smurf

Verified User
Joined
Mar 3, 2006
Messages
112
I purposely have created a user/domain already with the same name, however am attempting to again so that I can figure out error capturing. For some reason, even though DA is returning an error saying that domain already exists, the message my code is returning me is "User created". Why?

Below is my code:

Code:
if ( $Socket->get_status_code() != 200 || !empty($result['error']) )
{
    // failure.
    echo "Failed to add new user: {$result['details']}";
} else {

// new user added.
echo "User created";
}


What am I doing wrong?

Thanks!
 
Below is my code:

Code:
if ( $Socket->get_status_code() != 200 || !empty($result['error']) )
{
    // failure.
    echo "Failed to add new user: {$result['details']}";
} else {

// new user added.
echo "User created";
}


What am I doing wrong?

Thanks!

your code !empty($result['error']) is evaluating false(0) to get to the user created echo. Why? Not a clue :) ,but I would echo $result['error'] to make sure it is what you expect, then review the empty code. Maybe be more postive in your code ie $Socket->get_status_code()== 200 && empty($result['error']) then everything fine else houston we have a problem
 
Thanks!

I finally figured out how to do it. I am using regular expression checking to parse $result for specific words that are outputted by DA.

Works well!
 
Thanks!

I finally figured out how to do it. I am using regular expression checking to parse $result for specific words that are outputted by DA.

Works well!

Hi,

Would you care to share your regular expression with the rest of us so we can learn too?

Regards,
 
Back
Top