Use standard Python exceptions for returning errors, fixes #40