Pārlūkot izejas kodu

Added error handling for unknown operators

Alois Mahdal (@azzgoat) 12 gadus atpakaļ
vecāks
revīzija
1dc522dd0a
1 mainītis faili ar 6 papildinājumiem un 1 dzēšanām
  1. 6
    1
      lib/SugarTrail/Template/Condition.pm

+ 6
- 1
lib/SugarTrail/Template/Condition.pm Parādīt failu

@@ -77,7 +77,12 @@ sub match {
77 77
     my $want    = $params->{$name}; # what they want
78 78
 
79 79
     # execute the right handler
80
-    return &{ $self->{handlers}->{$op} }($want, $have);
80
+    if (exists $self->{handlers}->{$op}) {
81
+        return &{ $self->{handlers}->{$op} }($want, $have);
82
+    } else {
83
+        helper::dmupp(bad_op=>$self);
84
+        warn "unknown operator: $op\n";
85
+    }
81 86
 }
82 87
 
83 88