Updated method of outputting errors.

Also made sure to catch all potential exceptions thrown. Without doing
this, the program will exit entirely.