Getting errors while developing plugins So I've wasted a day because I couldn't figure out how to get an error back from an action I'm using in a plugin...

$newUserSuccess = craft()-&gt;users-&gt;saveUser($newUser);


$newUserSuccess was empty, and it turns out the reason was because the new user was trying to register with an existing user's email address, which fails. I could not figure out how to get any useful information back. I had tried this:

if (!$newUserSuccess)
{
    AutoUserEntryPlugin::log('Couldn't save the new user: '.print_r($newUser-&gt;getErrors(), true), LogLevel::Info);
    throw new Exception(Craft::t('Couldnt save the user.'));
}


but in the log all that was output was "Couldn’t save the new user: Array"

How should I be doing this?
You're getting "Couldn’t save the new user: Array" because $newUser-&gt;getErrors() returns an array of validation errors (in case there are more than one).

If you want to print them all to a log file, you can do something like this:

AutoUserEntryPlugin::log('Couldn't save the new user: '.implode(', ', $newUser-&gt;getErrors()), LogLevel::Info);