user186200
user186200

Reputation: 33

PHP Exceptions rather than errors

Is there a way in PHP to make sure that I get Exceptions for everything rather than errors?

Using two different methods of errorhandling leaves me uncomfortable and it feels messy. I'd prefer the Exception style method as its more OO and thus fits better with my other programming experience.

Upvotes: 3

Views: 224

Answers (1)

knittl
knittl

Reputation: 265221

you can set the default error handler to only throw an exception. you can then handle all exceptions in your default exception handler.

See set_error_handler()

Upvotes: 3

Related Questions