Skip to content

Commit

Permalink
Exception now has helpful string.
Browse files Browse the repository at this point in the history
Before;
```
  File "/usr/local/google/home/tansell/foss/timvideos/hdmi2usb/i2cslave/build/lib/python3.4/site-packages/migen-0.2-py3
.4.egg/migen/fhdl/structure.py", line 110, in __getitem__
    raise TypeError
TypeError
```

After;
```
  File "/usr/local/google/home/tansell/foss/timvideos/hdmi2usb/i2cslave/build/lib/python3.4/site-packages/migen-0.2-py3.4.egg/migen/fhdl/structure.py", line 110, in __getitem__
    raise TypeError("Can use type %s (%r) as key" % (type(key), key))
TypeError: Can use type <class 'migen.fhdl.structure.Signal'> (<Signal dbits at 0x7fd7836a2a90>) as key
```
mithro authored and sbourdeauducq committed Jan 3, 2016
1 parent 03bfb4b commit 3fca6c1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion migen/fhdl/structure.py
Original file line number Diff line number Diff line change
@@ -107,7 +107,8 @@ def __getitem__(self, key):
return Cat(self[i] for i in range(start, stop, step))
return _Slice(self, start, stop)
else:
raise TypeError
raise TypeError("Can use type {} ({}) as key".format(
type(key), repr(key)))

def eq(self, r):
"""Assignment

2 comments on commit 3fca6c1

@jordens
Copy link
Member

@jordens jordens commented on 3fca6c1 Jan 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But has it really? Looks like the string is wrong.

@sbourdeauducq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks

Please sign in to comment.