Travis build was failing due to a KeyError

Added a better error handler.