| 
64 | 64 |     TryAgainError,  | 
65 | 65 | )  | 
66 | 66 | from redis.typing import AnyKeyT, EncodableT, KeyT  | 
67 |  | -from redis.utils import deprecated_function, get_lib_version, safe_str, str_if_bytes  | 
 | 67 | +from redis.utils import deprecated_function, get_lib_version, safe_str, str_if_bytes, truncate_command_for_exception  | 
68 | 68 | 
 
  | 
69 | 69 | TargetNodesT = TypeVar(  | 
70 | 70 |     "TargetNodesT", str, "ClusterNode", List["ClusterNode"], Dict[Any, "ClusterNode"]  | 
@@ -1601,7 +1601,7 @@ async def _execute(  | 
1601 | 1601 |                         command = " ".join(map(safe_str, cmd.args))  | 
1602 | 1602 |                         msg = (  | 
1603 | 1603 |                             f"Command # {cmd.position + 1} "  | 
1604 |  | -                            f"({self._truncate_command(command)}) "  | 
 | 1604 | +                            f"({truncate_command_for_exception(command)}) "  | 
1605 | 1605 |                             f"of pipeline caused error: {result.args}"  | 
1606 | 1606 |                         )  | 
1607 | 1607 |                         result.args = (msg,) + result.args[1:]  | 
@@ -1651,11 +1651,6 @@ def mset_nonatomic(  | 
1651 | 1651 | 
 
  | 
1652 | 1652 |         return self  | 
1653 | 1653 | 
 
  | 
1654 |  | -    def _truncate_command(self, command, max_length=100):  | 
1655 |  | -        if len(command) > max_length:  | 
1656 |  | -            return command[: max_length - 3] + "..."  | 
1657 |  | -        return command  | 
1658 |  | - | 
1659 | 1654 | 
 
  | 
1660 | 1655 | for command in PIPELINE_BLOCKED_COMMANDS:  | 
1661 | 1656 |     command = command.replace(" ", "_").lower()  | 
 | 
0 commit comments