3417 unhandled rejection

Exceptions that are thrown are caught thereby fixing unhandled exceptions scenario. All three possibilities that could throw exception for this particular error are handled.