dot
dot

Reputation: 15680

How to do error handling when including other 3rd party libraries

I've added a 3rd party open source library to my php app. (phpseclib) I've wrapped all my calls to their methods with try / catch blocks and I'm handling all errors so that I handle errors gracefully.

However, because the 3rd party library doesn't have baked in error handling, when it dies, I get a php error from it + another codeigniter message that I'm throwing when I, let's say, try to connect to a device and it fails.

Aside from changing the library to include some error handling, I just want to make sure that there's nothing I can do to prevent these "unhandled" messages from appearing to the end user...

Thank you

Upvotes: 0

Views: 255

Answers (2)

str
str

Reputation: 44999

You can write your own error handler with set_error_handler() and ignore and/or handle errors according to their level.

Upvotes: 2

AGDM
AGDM

Reputation: 104

Probably:

// Turn off error reporting
error_reporting(0);

Upvotes: 0

Related Questions