redirect.py define exceptions before using it

Change-Id: I9db47726096ddb1b9ab0f8928c5a2c65215934fb
Merge "redirect.py define exceptions before using it"