Fixes #180 conversion errors are not handled correctly

I've added some negative tests for badly formatted and
empty string input and handle the exceptions.