redirect inside try/catch block – bug?

Notice: This thread is very old.
Budry
Member | 88
+
0
-

Hi,
I found strange behavior if I catching redirect()
I have two codes

public function adctionDefault()
{
	$this->redirect('Sign:');
}
public function adctionDefault()
{
	try {
		$this->redirect('Sign:');
	} catch (\Exception $e) {
		dump($e);
		die();
	}
}

First redirect is correct but twice return Nette\AbortException. Why?
This is bug or expected behavior?

Majkl578
Moderator | 1364
+
0
-

Feature, redirect throws an exception (presenter run is exception-driven in this case).

public function adctionDefault()
{
    try {
        $this->redirect('Sign:');
    } catch (Nette\Application\AbortException $e) {
        throw $e;
    } catch (\Exception $e) {
        dump($e);
        die();
    }
}
Budry
Member | 88
+
0
-

Thanks for explaining

honos
Member | 109
+
0
-

@Budry Inheritance? :o)