How can I get the cause of an error with cakephp 3

Hi,
I have an error when saving a user using

$this->Users->save($user)

My problem is not the cause of the error itself (I already found it), but how to get this cause. I cannot have the reason of the error. Both log and debug are enabled. Log levels are configured like the following, but I don’t see the cause of the problem in log files nore in page debug.

In app.php :

'debug'=>true

...

/**
     * Configures logging options
     */
    'Log' => [
        'debug' => [
            'className' => 'Cake\Log\Engine\FileLog',
            'path' => LOGS,
            'file' => 'debug',
            'levels' => ['notice', 'info', 'debug','trace','error','warning','critical', 'alert', 'emergency'],
            'url' => env('LOG_DEBUG_URL', null),
        ],
        'error' => [
            'className' => 'Cake\Log\Engine\FileLog',
            'path' => LOGS,
            'file' => 'error',
            'levels' => ['error', 'critical', 'alert', 'emergency'],
            'url' => env('LOG_ERROR_URL', null),
        ]
    ],

If it is beacude of validation or application rules $user->errors() will contain the error. If it is something else use a try - catch block to capture the expection.

Thank you.
You are right it was a validation error, but the real problem was that cakePHP did not provide me a documented way to read the cause of the error .

Great :slight_smile:
It is here: http://book.cakephp.org/3.0/en/core-libraries/validation.html#validating-data