diff Lib/IMPL/Web/QueryHandler/JsonFormat.pm @ 128:08753833173d

Fixed a error handling issue in JSON output: errors are correctly transfered A complete documentation for a IMPL::Web::Application::ControllerUnit
author wizard
date Tue, 15 Jun 2010 02:41:07 +0400
parents 41e9d9ea3db5
children 44977efed303
line wrap: on
line diff
--- a/Lib/IMPL/Web/QueryHandler/JsonFormat.pm	Fri Jun 11 20:21:07 2010 +0400
+++ b/Lib/IMPL/Web/QueryHandler/JsonFormat.pm	Tue Jun 15 02:41:07 2010 +0400
@@ -55,15 +55,6 @@
 				map { $this->Transform($_) } @$object
 			]; 
 		},
-		'IMPL::Exception' => sub {
-			my ($this,$object) = @_;
-			
-			return {
-				type => $object->type,
-				message => $object->Message,
-				arguments => $this->Transform(scalar $object->Args)
-			};	
-		},
 		-plain => sub {
 			$_[1];
 		},
@@ -72,6 +63,14 @@
 			
 			return "$object" unless $object->isa('IMPL::Object::Abstract');
 			
+			if ( $object->isa(typeof IMPL::Exception) ) {
+				return {
+					type => $object->typeof,
+					message => $object->Message,
+					arguments => $this->Transform(scalar $object->Args)
+				};
+			}
+			
 			my $propList = $propListCache{ref $object};
 			unless ( $propList ) {
 				my %props = map {