When I am giving wrong Database credentials like DBname or password at that time YII throws an exception.(attached in post). I want to display proper error message. Please help me for this. Eagerly waiting for your reply. Please be quick as possible.Attachment 4661 not found.
Can you please guide me that exact at which location this code should be written??
After DB Connection or before DB Connection in /config/main.php file…
I have written same code that you have given but it is not working, still giving same error. Is there any change required in your given code?? I put your code after DB Connection.
with config/main.php you are configuring your application object, cwebapplication, you can set all writeable properties as well as event-methods. event-Methods begin with ‘on’ like onBeginRequest. In Yii it is possible to attach event handlers by assigning an anoynmous function.
It is giving an error properly when DB credentials are wrong but then it will not allow to open any page. I want to redirect it to the Login page after displaying this error.