@borjasalguero - I left the generic error handling to #34 so that I did not create a PR that was too large.