More informative error handling

Improvements on #56. Thanks @45678 :-)