Adds several error codes
Adds exception catching for connection errors