Any return statement inside a generator will raise StopIteration. However, the exceptions raised by return cannot be caught via try, except blocks within that particular generator itself. It can be caught anywhere else other than the generator that is being returned.