cleanup error messages

This commit is contained in:
onyx-and-iris 2023-08-11 14:41:09 +01:00
parent b440ace20c
commit a40ab77be9

View File

@ -9,9 +9,8 @@ module OBSWS
@base_client = Base.new(**kwargs) @base_client = Base.new(**kwargs)
logger.info("#{self} successfully identified with server") logger.info("#{self} successfully identified with server")
rescue Errno::ECONNREFUSED, WaitUtil::TimeoutError => e rescue Errno::ECONNREFUSED, WaitUtil::TimeoutError => e
msg = "#{e.class.name}: #{e.message}" logger.error("#{e.class.name}: #{e.message}")
logger.error(msg) raise OBSWSConnectionError.new(e.message)
raise OBSWSConnectionError.new(msg)
else else
@base_client.updater = ->(op_code, data) { @base_client.updater = ->(op_code, data) {
logger.debug("response received: #{data}") logger.debug("response received: #{data}")
@ -48,19 +47,11 @@ module OBSWS
end end
@response[:responseData] @response[:responseData]
rescue OBSWSRequestError => e rescue OBSWSRequestError => e
err_msg = [ logger.error(["#{e.class.name}: #{e.message}", *e.backtrace].join("\n"))
"#{e.class.name}: #{e.message}",
*e.backtrace
]
logger.error(err_msg.join("\n"))
raise raise
rescue WaitUtil::TimeoutError => e rescue WaitUtil::TimeoutError => e
err_msg = [ logger.error(["#{e.class.name}: #{e.message}", *e.backtrace].join("\n"))
"#{e.class.name}: #{e.message}", raise OBSWSError.new([e.message, *e.backtrace].join("\n"))
*e.backtrace
]
logger.error(err_msg)
raise OBSWSError.new(err_msg)
end end
def get_version def get_version