Introduce custom exceptions, fixes #58.