[DependencyInjection] Added missing support for setting previous exception