diff Lib/IMPL/Web/Application/ControllerUnit.pm @ 127:0dce0470a3d8

In the IMPL::Web::ControllerUnit added the ability to notify a form about a wrong data from a transaction added a relativeUrl function for a usage from a templates IMPL::Web::TT::Form now fully functional
author wizard
date Fri, 11 Jun 2010 20:21:07 +0400
parents c8dfbbdd8005
children 08753833173d
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/ControllerUnit.pm	Fri Jun 11 04:29:51 2010 +0400
+++ b/Lib/IMPL/Web/Application/ControllerUnit.pm	Fri Jun 11 20:21:07 2010 +0400
@@ -116,7 +116,18 @@
 		} else {
 			$result{state} = STATE_CORRECT;
 			my $unit = $self->new($action,\%result);
-			$result{result} = $unit->method();
+			
+			eval {
+				$result{result} = $unit->$method();
+			};
+			if (my $err = $@) {
+				$result{state} = STATE_INVALID;
+				if (eval { $err->isa(typeof IMPL::WrongDataException) } ) {
+					$result{formErrors} = $err->Args;
+				} else {
+					die $err;
+				}
+			} 
 		}
 	} else {
 		$result{state} = STATE_NEW;