Rewrote the error handling module to check for object keys and report the correct error code associated with the failure, as well as includes default cases.