mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Wrap error for filter compiler
This commit is contained in:
parent
37a9ddc4ff
commit
17a358f994
2 changed files with 5 additions and 2 deletions
|
@ -74,7 +74,7 @@ namespace :benchmark do
|
|||
haml_benchmark.capture(haml_time)
|
||||
faml_benchmark.capture(faml_time)
|
||||
hamlit_benchmark.capture(hamlit_time)
|
||||
rescue Temple::FilterError, TypeError
|
||||
rescue Temple::FilterError, TypeError, Hamlit::FilterCompiler::NotFound
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,9 @@ module Hamlit
|
|||
class FilterCompiler
|
||||
@registered = {}
|
||||
|
||||
class NotFound < RuntimeError
|
||||
end
|
||||
|
||||
class << self
|
||||
attr_reader :registered
|
||||
|
||||
|
@ -24,7 +27,7 @@ module Hamlit
|
|||
|
||||
def find_compiler(name)
|
||||
compiler = FilterCompiler.registered[name.to_sym]
|
||||
raise "FilterCompiler for '#{name}' was not found" unless compiler
|
||||
raise NotFound.new("FilterCompiler for '#{name}' was not found") unless compiler
|
||||
|
||||
compiler
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue