Skip to content

Commit

Permalink
fix: add graceful degradation to constraint resolution if context key…
Browse files Browse the repository at this point in the history
… is not found
  • Loading branch information
sighphyre committed Mar 8, 2022
1 parent 06f3775 commit 73ca404
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/unleash/constraint.rb
Expand Up @@ -41,7 +41,12 @@ def matches_context?(context)
Unleash.logger.debug "Unleash::Constraint matches_context? value: #{self.value} context.get_by_name(#{self.context_name})" \
" #{context.get_by_name(self.context_name)} "
match = matches_constraint?(context)
puts "CHECKING A CONSTRAIT #{match}, #{self.operator}, #{context}"
self.inverted ? !match : match
rescue KeyError
Unleash.logger.debug "Attemped to resolve a context key during constraint resolution: #{self.context_name} but it wasn't \
found on the context"
false
end

def self.on_valid_date(val1, val2)
Expand Down

0 comments on commit 73ca404

Please sign in to comment.