Better error msg on catching exceptions

Report line number and what kind of exception on error, making debugging easier.