diff --git a/class-wp-codebird.php b/class-wp-codebird.php index 6f593b451af40543c348051f91073f2afaef1e11..04c13ad9b2ff573295e5d918ed3b9e57182a7e07 100644 --- a/class-wp-codebird.php +++ b/class-wp-codebird.php @@ -31,6 +31,20 @@ class WP_Codebird extends Codebird { return self::$_instance; } + /** + * Overload magic __call() to transparently intercept Exceptions + * + * Most exceptions encountered in production are API timeouts - this will + * transparently handle these Exceptions to prevent fatal errors + */ + public function __call( $function, $arguments ) { + try { + return parent::__call( $function, $arguments ); + } catch ( Exception $e ) { + return array(); + } + } + /** * Calls the API using Wordpress' HTTP API. *