Skip to content

Commit 1bc704f

Browse files
committed
Tweak exception messages
1 parent cd263f8 commit 1bc704f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/azul/collections.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class deep_dict_merge[K, V](dict):
9494
>>> deep_dict_merge({0: 1}, {0: 2})
9595
Traceback (most recent call last):
9696
...
97-
ValueError: 1 != 2
97+
ValueError: ('Conflicting values', 1, 2)
9898
9999
>>> deep_dict_merge({0: 1}, {0: 2}, override=True)
100100
{0: 2}
@@ -105,7 +105,7 @@ class deep_dict_merge[K, V](dict):
105105
>>> deep_dict_merge({0: 1}, {0: {2: 3}})
106106
Traceback (most recent call last):
107107
...
108-
ValueError: ('Cannot merge dict with non-dict', 1, {2: 3})
108+
ValueError: ('Can only merge mappings', 1, {2: 3})
109109
110110
To merge all mappings in an iterable, use this form:
111111
@@ -141,9 +141,9 @@ def _merge(self, maps: Iterable[Mapping[K, V]]):
141141
if self.override:
142142
self[k] = v2
143143
else:
144-
raise ValueError(f'{v1!r} != {v2!r}')
144+
raise ValueError('Conflicting values', v1, v2)
145145
case _:
146-
raise ValueError('Cannot merge dict with non-dict', v1, v2)
146+
raise ValueError('Can only merge mappings', v1, v2)
147147

148148

149149
def explode_dict[K, V](d: Mapping[K, Union[V, list[V], set[V], tuple[V]]]

0 commit comments

Comments
 (0)