Yii Framework Forum: Throwing Exceptions When Php Errors/warnings Occur - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Throwing Exceptions When Php Errors/warnings Occur

#1 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 20 February 2013 - 07:46 AM

That just happened to me. Imagine a long running script writing to a database within a transaction. The script may time out or run out of memory, thus causing a PHP error that can't be catched within a try catch/block. Yes, one could manually define an error handler with set_error_handler but I guess this is something that could be built right into the core. What do you guys think? I like the idea of errors being treated as exceptions that can always be catched and handled.
1

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,313
  • Joined: 04-March 10
  • Location:UK

Posted 20 February 2013 - 10:32 AM

According to this page:

Quote

Ready December 26, 2012

yiic create (better yiic webapp).
Better validation (rules divided into rules and scenarios, removed safe and unsafe).
Better error handler (errors are converted to ErrorException).


So, I think it's already implemented.
0

#3 User is offline   Haensel 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 444
  • Joined: 14-January 11
  • Location:Vienna (Austria)

Posted 20 February 2013 - 11:19 AM

Ah, thanks Keith, didn't see that. Yet another point to look forward to Yii 2.0 :) Very nice. Hope the new handler can also be configured to throw exceptions on warnings (deprecated warnings etc.). I guess this could be useful too
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,134
  • Joined: 17-January 09
  • Location:Russia

Posted 20 February 2013 - 11:48 PM

Also Yii 2 will probably handle fatal errors. These, of course cannot be catched but at least it is possible to display these in a nice way and log using Yii router.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
3

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users