Exception breaks foreach in router