produce a useful error message
Matt S Trout [Fri, 14 Feb 2014 19:54:21 +0000 (19:54 +0000)]
lib/DX/Op/Materialize.pm

index 7b52715..ee17e55 100644 (file)
@@ -8,7 +8,11 @@ has var_name => (is => 'ro', required => 1);
 
 sub run {
   my ($self, $state) = @_;
-  $state->resolve_value($state->scope_var($self->var_name));
+  my $var = $state->scope_var($self->var_name);
+  unless ($var->is_bound) {
+    die "Can't materialize unbound ".$self->var_name;
+  }
+  $state->resolve_value($var);
   $state->then($self->next);
 }