php - Why does this exception propagate all the way to App::fatal? -


in snippet problem i'm saving $model null (thanks @lucas brito).
don't understand is:

  1. why exception isn't caught in try/catch around $model->save()
  2. why $exception variable in app::fatal empty
  3. how show more explicit error

every time call $model->save();

$new = new system(); $new->imcid = $imcid; $new->name = $name; $new->validate(); log::info('at update'); try{     $model->save(); }catch(\exception $e){     log::info('exception thrown'); } log::info('done'); 

in log can see 'at update' not 'exception thrown' or 'done'.
message defined on routes.php

app::fatal(function($exception){     return response::json(array(         'message' => 'damn...',         'exception' => $exception     ), 500); }); 

i think you're trying save wrong variable. shouldn't save $new?

here's how do:

$reg = new area;  $reg->name          = $name; $reg->created_at    = time(); $reg->created_by    = auth::user()->id;  $reg->save(); 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -