Catch general exception to prevent unexpected crash.