Skip to main content

v1.1 Changelogs

· One min read
digitalisdizzy
Changelog Summary
+ Added Class APIError
+ Added Enum HttpStatus
* Changed Server.makeRequest() method to throw an APIError instead of a string

Additions

APIError class

Added the APIError Class to make error handling easier. Before, if the request wasn't successful, it would just throw a string with information, but now it gives this object.

Example
privateServer.getPlayers().catch(console.log)

// Example response

APIError {
status: 429,
humanReadableMessage: "You are being ratelimited. Respect the retryAfter property of the APIError or you risk a temporary ban from the API.",
retryAfter: 10000,
responseObject: Response
}

See more in the documentation

HttpStatus enum

Added the HttpStatus Enum. This is for the APIError class so it is easier to handle errors.

See more in the documentation

Changes

Server.makeRequest()

Changed Server.makeRequest() (and subsequently all Server methods that use the makeRequest method) to throw an APIError object instead of a string.