refactor call

This commit is contained in:
onyx-and-iris 2023-08-02 00:00:05 +01:00
parent f3b8e97d5a
commit 9ed21ffc38

View File

@ -65,16 +65,17 @@ module Voicemeeter
res = send(fn, *args)
if exp
unless exp.call(res) || ok.include?(res)
logger.error "#{to_cname.call} returned #{res}"
raise Errors::VMCAPIError.new to_cname.call, res
end
else
unless ok.include?(res)
logger.error "#{to_cname.call} returned #{res}"
raise Errors::VMCAPIError.new to_cname.call, res
end
end
res
rescue Errors::VMCAPIError => e
logger.error "#{e.class.name}: #{e.message}"
raise
end
module_function :call