Explorar o código

+ V::tryHandleException(handler, callback, args)

Piotr Labudda %!s(int64=6) %!d(string=hai) anos
pai
achega
5bb512c12d
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      SE/se-lib/V.php

+ 11 - 0
SE/se-lib/V.php

@@ -729,4 +729,15 @@ EOF';
 		return (false === $ret) ? [] : $ret;
 	}
 
+	static function tryHandleException($handler, $callback, $args) { // try again on exception
+		try {
+			return call_user_func_array($callback, $args);
+		} catch (Exception $e) {
+			DBG::log("DBG:V->tryHandleException Exception trying to fix using handler ...");
+			DBG::log($e);
+			$handler($e);
+			return call_user_func_array($callback, $args);
+		}
+	}
+
 }