summaryrefslogtreecommitdiff
path: root/lib/DeWeave/Collection.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DeWeave/Collection.pm')
-rw-r--r--lib/DeWeave/Collection.pm22
1 files changed, 19 insertions, 3 deletions
diff --git a/lib/DeWeave/Collection.pm b/lib/DeWeave/Collection.pm
index 92c5342..6ad87eb 100644
--- a/lib/DeWeave/Collection.pm
+++ b/lib/DeWeave/Collection.pm
@@ -3,8 +3,11 @@ use Moose;
use namespace::autoclean;
use MooseX::Types::Moose qw(ArrayRef);
use JSON::Any;
+use Try::Tiny;
use DeWeave::EDO;
use Lingua::EN::Inflect::Number 'to_S';
+use Log::Log4perl ':easy';
+use Data::Dump 'pp';
has items => (
isa => ArrayRef['DeWeave::WBO'],
@@ -38,9 +41,22 @@ sub from_json {
my $args = $j->decode($json);
- my @items = map {
- $class->item_class->new({%$_,__crypt=>$crypt})
- } @$args;
+DEBUG '$args ',{filter=>\&pp,value=>$args};
+
+ my @items;
+
+ for my $input_item (@$args) {
+ my $item;
+ try {
+ $item = $class->item_class->new({%$input_item,__crypt=>$crypt})
+ }
+ catch {
+ die $_ unless ref($_) && $_->isa('DeWeave::Exception::Deleted');
+ };
+ push @items,$item
+ if $item;
+ }
+
return $class->new({
items => \@items,
});