Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion bin/utils/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,27 @@ export const isResError = resclient.isResError;

class ApiClient extends ResClient {
constructor(apiUrl, token) {
super(() => new WebSocket(apiUrl));
let debugLog = [];
super(() => new WebSocket(apiUrl), {
debug: (type, msg, ctx) => {
// Debug logging for a specific type of error. If encountered,
// we output all stored logs. To prevent large binaries, we
// replace them with a char count.
debugLog.push(Date.now() + " " + msg.replace(/"binary":"([^"]*)"/g, (m, a, b) => `"binary":"CHARS(${a.length})"`));
if (type == 'addIndirectError') {
console.log("\n--------- LOG DUMP START ----------\n");
for (let d of debugLog) {
console.log(d);
}
console.log("\n---------- LOG DUMP END -----------\n");
console.log("You've encountered a tricky to replicate bug!");
console.log("To help me resolve it, copy the logs above (from LOG DUMP START to LOG DUMP END).\nThen go to GitHub and create an issue with the logs at:\n");
console.log("https://github.com/mucklet/mucklet-script/issues");
console.log("\nThanks for the helping me solve this!")
console.log("/Accipiter")
}
},
});

this.authErr = null;

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"assemblyscript": "^0.28.8",
"isomorphic-ws": "^5.0.0",
"json-as": "1.1.21",
"resclient": "^2.5.0",
"resclient": "^2.5.1",
"tinyargs": "^0.1.4",
"visitor-as": "^0.11.4"
},
Expand Down