2023-08-11 02:22:14 +01:00
|
|
|
require "digest/sha2"
|
|
|
|
require "json"
|
2023-08-11 17:04:38 +01:00
|
|
|
require "logger"
|
|
|
|
require "securerandom"
|
2023-08-11 02:22:14 +01:00
|
|
|
require "socket"
|
2023-08-11 17:04:38 +01:00
|
|
|
require "waitutil"
|
2023-08-11 02:22:14 +01:00
|
|
|
require "websocket/driver"
|
|
|
|
|
|
|
|
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-29 15:45:42 +01:00
|
|
|
# Base OBSWS error class
|
2023-08-11 02:22:14 +01:00
|
|
|
class OBSWSError < StandardError; end
|
|
|
|
|
2023-08-29 15:45:42 +01:00
|
|
|
# Raised when a connection fails or times out
|
2023-08-11 02:22:14 +01:00
|
|
|
class OBSWSConnectionError < OBSWSError; end
|
|
|
|
|
2023-08-29 15:45:42 +01:00
|
|
|
# Raised when a request returns an error code
|
2023-08-11 02:22:14 +01:00
|
|
|
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-17 16:13:57 +01:00
|
|
|
def initialize(req_name, code, comment)
|
2023-08-11 13:16:27 +01:00
|
|
|
@req_name = req_name
|
2023-08-11 02:22:14 +01:00
|
|
|
@code = code
|
2023-08-17 16:18:50 +01:00
|
|
|
message = "Request #{@req_name} returned code #{@code}."
|
2023-08-17 16:13:57 +01:00
|
|
|
message << " With message: #{comment}" if comment
|
2023-08-11 02:22:14 +01:00
|
|
|
super(message)
|
|
|
|
end
|
|
|
|
end
|
2022-10-22 22:30:40 +01:00
|
|
|
end
|