Dave Rolsky wrote:
On Mon, 14 May 2007, mla wrote:
Could you give an example of how you munge the exceptions into error
messages for the user?

 eval
 {
     $user->update( %bunch_of_stuff );
 };

if ( my $e = Exception::Class->caught( 'My::App::Exception::DataValidation') )
 {
     # $e->errors contains multiple data validation error messages
     # stuff them in the session
     # save the user's form submission in the session
     # redirect back to form
 }
 elsif ( my $e = $@ )
 {
     die $e;
 }

Then on the display side, I check the session for error messages and saved form arguments, and do something useful with them.

That's excellent. Thank you. I'm going to throw together an experimental
page using this idiom.

Maurice

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to