2023-07-17 06:03:37 +01:00
|
|
|
require_relative "util"
|
2023-07-15 00:16:35 +01:00
|
|
|
|
2023-07-07 02:31:22 +01:00
|
|
|
module Voicemeeter
|
|
|
|
module Errors
|
|
|
|
class VMError < StandardError
|
|
|
|
end
|
|
|
|
|
|
|
|
class VMCAPIError < VMError
|
2023-07-15 00:16:35 +01:00
|
|
|
attr_reader :code
|
|
|
|
|
|
|
|
def initialize(ruby_name, code)
|
|
|
|
@ruby_name = ruby_name
|
|
|
|
@code = code
|
|
|
|
super(message)
|
|
|
|
end
|
|
|
|
|
|
|
|
def message
|
|
|
|
"#{fn_name} returned #{code}"
|
|
|
|
end
|
|
|
|
|
|
|
|
def fn_name
|
2023-07-17 14:13:08 +01:00
|
|
|
"VBVMR_#{Util::String.camelcase(@ruby_name.to_s.delete_prefix("bind_")).sub("macro_button", "macrobutton")}"
|
2023-07-15 00:16:35 +01:00
|
|
|
end
|
2023-07-07 02:31:22 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|