Add support for exceptions

Fix #21