comparison 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
comparison
equal deleted inserted replaced
127:0dce0470a3d8 128:08753833173d
53 53
54 return [ 54 return [
55 map { $this->Transform($_) } @$object 55 map { $this->Transform($_) } @$object
56 ]; 56 ];
57 }, 57 },
58 'IMPL::Exception' => sub {
59 my ($this,$object) = @_;
60
61 return {
62 type => $object->type,
63 message => $object->Message,
64 arguments => $this->Transform(scalar $object->Args)
65 };
66 },
67 -plain => sub { 58 -plain => sub {
68 $_[1]; 59 $_[1];
69 }, 60 },
70 -default => sub { 61 -default => sub {
71 my ($this,$object) = @_; 62 my ($this,$object) = @_;
72 63
73 return "$object" unless $object->isa('IMPL::Object::Abstract'); 64 return "$object" unless $object->isa('IMPL::Object::Abstract');
65
66 if ( $object->isa(typeof IMPL::Exception) ) {
67 return {
68 type => $object->typeof,
69 message => $object->Message,
70 arguments => $this->Transform(scalar $object->Args)
71 };
72 }
74 73
75 my $propList = $propListCache{ref $object}; 74 my $propList = $propListCache{ref $object};
76 unless ( $propList ) { 75 unless ( $propList ) {
77 my %props = map { 76 my %props = map {
78 $_->Name, (ref $_->Mutators ? 0 : ($_->Mutators & prop_list)) 77 $_->Name, (ref $_->Mutators ? 0 : ($_->Mutators & prop_list))