clean up exception handling

- rename some exceptions
- do not use failwith