2023-08-11 02:22:14 +01:00
|
|
|
require "digest/sha2"
|
|
|
|
require "json"
|
|
|
|
require "waitutil"
|
|
|
|
require "socket"
|
|
|
|
require "websocket/driver"
|
|
|
|
require "logger"
|
|
|
|
|
|
|
|
require_relative "obsws/logger"
|
|
|
|
require_relative "obsws/driver"
|
|
|
|
require_relative "obsws/util"
|
|
|
|
require_relative "obsws/mixin"
|
|
|
|
require_relative "obsws/base"
|
|
|
|
|
2022-10-22 22:30:40 +01:00
|
|
|
require_relative "obsws/req"
|
|
|
|
require_relative "obsws/event"
|
|
|
|
|
2023-08-11 02:22:14 +01:00
|
|
|
require_relative "obsws/version"
|
|
|
|
|
2022-10-22 22:30:40 +01:00
|
|
|
module OBSWS
|
2023-08-11 02:22:14 +01:00
|
|
|
class OBSWSError < StandardError; end
|
|
|
|
|
|
|
|
class OBSWSConnectionError < OBSWSError; end
|
|
|
|
|
|
|
|
class OBSWSRequestError < OBSWSError
|
2023-08-11 13:10:44 +01:00
|
|
|
attr_reader :req_name, :code
|
2023-08-11 02:22:14 +01:00
|
|
|
|
2023-08-11 13:10:44 +01:00
|
|
|
def initialize(req_name, code, msg)
|
2023-08-11 13:16:27 +01:00
|
|
|
@req_name = req_name
|
2023-08-11 02:22:14 +01:00
|
|
|
@code = code
|
|
|
|
@msg = msg
|
|
|
|
super(message)
|
|
|
|
end
|
|
|
|
|
|
|
|
def message
|
|
|
|
msg = [
|
2023-08-11 13:18:28 +01:00
|
|
|
"Request #{@req_name} returned code #{@code}."
|
2023-08-11 02:22:14 +01:00
|
|
|
]
|
|
|
|
msg << "With message: #{@msg}" if @msg
|
|
|
|
msg.join(" ")
|
|
|
|
end
|
|
|
|
end
|
2022-10-22 22:30:40 +01:00
|
|
|
end
|