From 9ed21ffc38e4e5bc4abc4a99917976f7af03745f Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 2 Aug 2023 00:00:05 +0100 Subject: [PATCH] refactor call --- lib/voicemeeter/cbindings.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/voicemeeter/cbindings.rb b/lib/voicemeeter/cbindings.rb index cdc538f..febd2c3 100644 --- a/lib/voicemeeter/cbindings.rb +++ b/lib/voicemeeter/cbindings.rb @@ -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