Skip to content

Commit

Permalink
Don't store a client option in the API class
Browse files Browse the repository at this point in the history
  • Loading branch information
RiskoZoSlovenska committed Dec 7, 2023
1 parent bf7d3b9 commit 2290a49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions libs/client/API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ end

local API = require('class')('API')

function API:__init(client, logFullErrors)
function API:__init(client)
self._client = client
self._mutexes = setmetatable({}, mutexMeta)
self._logFullErrors = logFullErrors
end

function API:authenticate(token)
Expand Down Expand Up @@ -238,7 +237,7 @@ function API:commit(method, url, req, payload, retries)
end

local errMsg = f('%i - %s : %s %s', res.code, res.reason, method, url)
if self._logFullErrors then
if options.logFullErrors then
errMsg = errMsg .. "\n" .. msg
end
client:error(errMsg)
Expand Down
2 changes: 1 addition & 1 deletion libs/client/Client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function Client:__init(options)
options = assert(parseOptions(options))
self._options = options
self._shards = {}
self._api = API(self, options.logFullErrors)
self._api = API(self)
self._mutex = Mutex()
self._users = Cache({}, User, self)
self._guilds = Cache({}, Guild, self)
Expand Down

0 comments on commit 2290a49

Please sign in to comment.