noblox.js
noblox.js copied to clipboard
Migrate methods to RobloxAPIError class
Currently draft because I may not be totally done but am open to help if someone is willing.
Does not include:
- Anything involving SignalR (will possibly make something else for this)
upload[thing]methods since those need new endpointsbuy()since it doesn't work anymore, requires multiple endpoints + 2fa, and is generally abused [eligible for removal]configureItemandcanManagesince those also need new endpoints
Yeah at this point I'm not really sure what else to do with this.
Review time it is.
Wow, big PR. Thanks - will review this weekend. From a quick read over, looking at ApiError (I know it hasn't changed in this PR but you authored it originally:
function getResponseBody (data) {
if (typeof data.body === 'string') return data.body
try {
return JSON.stringify(data.body)
} catch {
throw Error('The passed response body is not a valid object')
}
}
What is the behaviour here if the value passed is not a valid object? Is the actual API error returned from Roblox swallowed and the 'The passed response body is not a valid object' returned instead? Perhaps we could have the robloxApiError class as we currently do and another error class (like UnknownRobloxApiError) which exposes the raw text.
Wow, big PR. Thanks - will review this weekend. From a quick read over, looking at ApiError (I know it hasn't changed in this PR but you authored it originally:
function getResponseBody (data) { if (typeof data.body === 'string') return data.body try { return JSON.stringify(data.body) } catch { throw Error('The passed response body is not a valid object') } }What is the behaviour here if the value passed is not a valid object? Is the actual API error returned from Roblox swallowed and the 'The passed response body is not a valid object' returned instead? Perhaps we could have the robloxApiError class as we currently do and another error class (like UnknownRobloxApiError) which exposes the raw text.
It will get swallowed. However, anything returned by Roblox should not reach this point (as all requests made through http come back as full responses [which have string/non-parsed bodies]). It is a failsafe against people misusing it, e.g. importing the class and passing a date object as the body.
Happy to approve once linting passes. Shall we also remove buy()? This will be a breaking change anyway
Yeah that's fine
I'll try to deal with linting tonight
:tada: This PR is included in version 6.2.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket: