Skip to content

Commit

Permalink
Better error when WebSocket connection closes (#976)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
tomaka and mergify[bot] committed Jun 23, 2021
1 parent aa7b588 commit c42f4d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/wasm-node/javascript/src/bindings-smoldot-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default (config) => {
config.instance.exports.connection_open(id);
};
connection.onclose = (event) => {
const message = event.code + " " + event.reason;
const message = "Error code " + event.code + (!!event.reason ? (": " + event.reason) : "");
const len = Buffer.byteLength(message, 'utf8');
const ptr = config.instance.exports.alloc(len);
Buffer.from(config.instance.exports.memory.buffer).write(message, ptr);
Expand Down

0 comments on commit c42f4d6

Please sign in to comment.