dimanche 3 juillet 2016

Laravel 5 abort not returning error message

I'm trying to throw an error from my Laravel 5.1 app to my frontend Angular app. The thrown errors are not returning the actual status message, which I need:

if (Hash::check($updated_profile['current_password'], $user->password)) {
    $user->password = Hash::make($updated_profile['new_password']);
    return $user;
} else {
    abort(500, 'Passwords do not match');
}

I've also tried throw new \Exception('Passwords do not match');

For both, I get an error on the frontend, but it's missing the status message:

Object
  data: null
  headers:(name)
  status: 0
  statusText:""
  __proto__: Object



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire