public static function error(Exception $e, $sql, $params = array(), $shardID = 0) { $paramsArray = Z_Array::array2string($params); $error = $e->getMessage(); $errno = $e->getCode(); $str = "{$error}\n\n" . "Shard: {$shardID}\n\n" . "Query:\n{$sql}\n\n" . "Params:\n{$paramsArray}\n\n"; if (function_exists('xdebug_get_function_stack')) { $str .= Z_Array::array2string(xdebug_get_function_stack()); } if (strpos($error, "Can't connect to MySQL server") !== false) { throw new Exception($str, Z_ERROR_SHARD_UNAVAILABLE); } throw new Exception($str, $errno); }
private static function getErrorString(Exception $e, $sql, $params = [], $shardID = 0) { $error = $e->getMessage(); $paramsArray = Z_Array::array2string($params); $str = "{$error}\n\n" . "Shard: {$shardID}\n\n" . "Query:\n{$sql}\n\n" . "Params:\n{$paramsArray}\n\n"; if (function_exists('xdebug_get_function_stack')) { $str .= Z_Array::array2string(xdebug_get_function_stack()); } return $str; }