Fleshed out Error Dialog.

Added some error codes.
Made use of the Error Dialog in places where exceptions were being caught.