mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 19:30:47 -07:00
Raise Liquid::ZeroDivisionError instead of ZeroDivisionError.
This commit is contained in:
@@ -57,4 +57,5 @@ module Liquid
|
|||||||
StackLevelError = Class.new(Error)
|
StackLevelError = Class.new(Error)
|
||||||
TaintedError = Class.new(Error)
|
TaintedError = Class.new(Error)
|
||||||
MemoryError = Class.new(Error)
|
MemoryError = Class.new(Error)
|
||||||
|
ZeroDivisionError = Class.new(Error)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ module Liquid
|
|||||||
# division
|
# division
|
||||||
def divided_by(input, operand)
|
def divided_by(input, operand)
|
||||||
apply_operation(input, operand, :/)
|
apply_operation(input, operand, :/)
|
||||||
|
rescue ::ZeroDivisionError => e
|
||||||
|
raise Liquid::ZeroDivisionError.new(e.message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def modulo(input, operand)
|
def modulo(input, operand)
|
||||||
|
|||||||
Reference in New Issue
Block a user