I would avoid using exception handling to describe business logic. I would do:

```
if key in primary keys:
   raise DuplicateRecordError
else:
   insert(bla, bla, bla)
````

What do you think?