Redirect vraci vyjimku bez textu

Upozornění: Tohle vlákno je hodně staré a informace nemusí být platné pro současné Nette.
radecek
Člen | 23
+
0
-

Ahoj,

mam registracni formular kde se uzivatel uklada to tabulky pomoci metody tridy Human:

...
  public static function registration($login, $firstName, $secondName, $password, $email, $phone) {
    try {
      $insert = dibi::query('INSERT INTO [user]', array(
                  'login' => $login,
                  'firstName' => $firstName,
                  'secondName' => $secondName,
                  'password' => sha1($password),
                  'email' => $email,
                  'phone' => $phone,
                  'ugroup' => Human::user));
    } catch (Exception $e) {
      throw new Exception("Došlo k chybě na straně serveru");
    }
  }
...
V presenteru mam onSubmit metodu:
public function registerUser_onSubmit(Form $form) {
  if ($form->isValid() && $form->isSubmitted()) {
    $formData = $form->getValues();
    try {
      Human::registration($formData['login'], $formData['firstName'], $formData['secondName'], $formData['password'], $formData['email'], $formData['phone']);
      $this->redirect("pass");
    } catch (Exception $e) {
      $form->addError($e->getMessage());
    }
  }
}

Pokud se tedy nevyhodi vyjimka melo by dojit k presmerovani na pass (adresa s pass funguje). I pres to mi redirect vyhazuje tuto vyjimku:

exception 'AbortException' in D:\www\dk\libs\Nette\Application\Presenter.php:762
 Stack trace: #0 D:\www\dk\libs\Nette\Application\Presenter.php(714):
 Presenter->terminate(Object(RedirectingResponse))
 #1 D:\www\dk\libs\Nette\Application\PresenterComponent.php(346): Presenter->redirectUri('http://dk/?pres...', NULL)
 #2 D:\www\dk\app\presenters\RegistrationPresenter.php(63): PresenterComponent->redirect('this')
 #3 [internal function]: RegistrationPresenter->registerUser_onSubmit(Object(AppForm))
 #4 D:\www\dk\libs\Nette\Utils\Callback.php(112): call_user_func_array(Array, Array)
 #5 D:\www\dk\libs\Nette\Utils\ObjectMixin.php(56): Callback->invokeArgs(Array)
 #6 D:\www\dk\libs\Nette\Utils\Object.php(90): ObjectMixin::call(Object(AppForm), 'onSubmit', Array)
 #7 [internal function]: Object->__call('onSubmit', Array)
 #8 D:\www\dk\libs\Nette\Forms\Form.php(447): AppForm->onSubmit(Object(AppForm))
 #9 D:\www\dk\libs\Nette\Application\AppForm.php(133): Form->fireEvents()
 #10 D:\www\dk\libs\Nette\Application\Presenter.php(325): AppForm->signalReceived('submit')
 #11 D:\www\dk\libs\Nette\Application\Presenter.php(198): Presenter->processSignal()
 #12 D:\www\dk\libs\Nette\Application\Application.php(144): Presenter->run(Object(PresenterRequest))
 #13 D:\www\dk\app\bootstrap.php(47): Application->run()
 #14 D:\www\dk\document_root\index.php(13): require('D:\www\dk\app\b...')
 #15 {main}

Nevite co delam spatne?

Editoval radecek (20. 12. 2010 22:53)

Panda
Člen | 569
+
0
-

Redirect je realizovaný výjimkou. Přepiš blok catch tak, aby nezachytával obecnou výjimku Exception, ale například DibiException.

radecek
Člen | 23
+
0
-

Aha dekuji uz to funguje :)