disable display error, using try catch

HI!,

quite simple anserw: i have phalcon project and i use transaction manager to catching errors while inserting to DB. and i have try{}catch{$this->flash->error()} but when goes something wrong (e.g. too long string) i have printed SQL error.

How to disable showing errors and show page with flash message?

Best regards



36.5k

Hi

You try this

try {

    } catch (Exception $e) {
        $this->flash->error('This is test messages');
    }


2.9k

i have something like that:

                    try {
                        $manager = $this->transaction;
                        $transaction = $manager->get();

                        $rank->setTransaction($transaction);
                        if (!$rank->save()) {
                            $transaction->rollback('Update user error');
                        }

                        $transaction->commit();

                        $this->flashSession->success('Dodano rangę poprawnie');
                        return $this->response->redirect('admin/calendar/rank');
                    } catch (Phalcon\Mvc\Model\Transaction\Failed $e) {
                        $this->logger->alert("Updating / activating user account problems: \n" . $e->getMessage());
                        $this->flash->error('Wystąpił błąd. Spróbuj ponownie lub skontaktuj się z obsługą aplikacji');
                    }