updated redirect method with correct exception throwing