Adds basic exception handling.