node-screeps-api uses the debug package to expose diagnostic information. Debug output is divided into several namespaces:
screepsapi:config: ScreepsConfigManager operationsscreepsapi:http: HTTP requestsscreepsapi:ratelimit: HTTP API rate limit statescreepsapi:ratelimitexceeded: HTTP API endpoint rate limit exceeded eventsscreepsapi:socket: WebSocket API events/messagesMultiple namespaces can be specified by providing a comma-delimited list (ex: screepsapi:http,screepsapi:ratelimit). All namespaces can be specified by providing screepsapi:*.
To enable debug output in Node, set the DEBUG environment variable to the
namespace(s) you want to enable. Here is an example that uses the CLI in bash:
DEBUG=screepsapi:http,screepsapi:ratelimit screeps-api call --server main authMe
These environment variables work when invoking your own apps as well.
You can also enable/disable debug logs dynamically using ScreepsHttpClient.debug():
const api = await ScreepsHttpClient.fromConfig('main')
// Enable debug logging for HTTP requests and rate limits:
api.debug({ http: true, rateLimit: true })
// Disable all debug logging
api.debug()
Most errors thrown by ScreepsHttpClient will be instances of:
ScreepsSocketClient emits ScreepsSocketClient.ERROR events for any errors sent by the server or generated within the client.
Please consider submitting a PR to document possible error types emitted via ScreepsSocketClient.ERROR and the conditions under which to expect them.