hello Tomas and everyone,
Thank you for that.
I got it working.
What I also did was the in the case of an exception, I will redirect
the user back to the main page with the error shown.
I would like to share what I did.
On Root.pm->end: I passed the error message to the flash (I have
flash_to_stash turned on) because due to a redirection, the only way the
error message can be sustained is via the flash.
============
sub end : ActionClass('RenderView') {
my ($self, $c) = @_;
if ( scalar @{ $c->error } ) {
$c->flash->{errors} = $c->error;
$c->response->redirect($c->uri_for('/'));
$c->error(0);
}
return 1;
};
On my controller, Subscriptions.pm
=======================
sub _save_address : Private
{
eval
{
.....
};
if ($@)
{
$c->error (' A problem occurred when saving your address.
Please try again later' );
}
}
Using die(' A problem occurred when saving your address. Please try
again later' );,
I would get an error message such as "Exception caught in
myApp::Controller::Subscription->_save_address" which doesn't look so
good to the users.
that's why I used $c->error.
Please tell me if it's bad practice?
thank you, everybody for your time! :)
K. akimoto
On Mon, Jul 6th, 2009 at 12:22 AM, Tomas Doran <
bobtfish@...>
wrote:
_______________________________________________
List:
Catalyst@...
Listinfo:
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalystSearchable archive:
http://www.mail-archive.com/catalyst@.../Dev site:
http://dev.catalyst.perl.org/