When a caller tries to import a nonexistent type from a combined type lib, give a...
[gitmo/MooseX-Types.git] / lib / MooseX / Types / Combine.pm
index b44a4c8..1e33a08 100644 (file)
@@ -45,7 +45,14 @@ sub import {
     } @type_libs;
 
     my %from;
-    push @{ $from{ $types{ $_ } } }, $_ for @types;
+    for my $type (@types) {
+        die
+            "$caller asked for a type ($type) which is not found in any of the"
+            . " type libraries (@type_libs) combined by $class\n"
+            unless $types{$type};
+
+        push @{ $from{ $types{$type} } }, $type;
+    }
 
     $_->import({ -into => $caller }, @{ $from{ $_ } })
         for keys %from;