git ssb

0+

farewellutopia-dev / deno-ssb-experiments



Commit 14a6c319df190f025e40c904f0de2bded7c67a95

recovering on error in procedure

Reto Gmür committed on 9/12/2021, 4:15:39 PM
Parent: 52931649689d0003c175b7df25d6e2314ae5cd7e

Files changed

comm/rpc/RpcConnection.tschanged
comm/rpc/RpcConnection.tsView
@@ -113,24 +113,29 @@
113113 if (request.type === "source") {
114114 const responseIterator = this.requestHandler
115115 .handleSourceRequest(request.name, request.args);
116116 (async () => {
117- for await (
118- const value of {
119- [Symbol.asyncIterator]: () => responseIterator,
117 + try {
118 + for await (
119 + const value of {
120 + [Symbol.asyncIterator]: () => responseIterator
121 + }
122 + ) {
123 + log.debug(() => "sending back " + JSON.stringify(value));
124 + try {
125 + await this.sendRpcMessage(value, {
126 + isStream: true,
127 + inReplyTo: header.requestNumber,
128 + });
129 + } catch (error) {
130 + log.error(
131 + `Error sending back ${JSON.stringify(value)}: ${error}`,
132 + );
133 + }
120134 }
121- ) {
122- log.debug(() => "sending back " + JSON.stringify(value));
123- try {
124- await this.sendRpcMessage(value, {
125- isStream: true,
126- inReplyTo: header.requestNumber,
127- });
128- } catch (error) {
129- log.error(
130- `Error sending back ${JSON.stringify(value)}: ${error}`,
131- );
132- }
135 + } catch (error) {
136 + log.error(`Error iterating on respone on ${request.name} (${JSON.stringify(request.args)}) request by ${this.boxConnection.peer}: ${error.stack}`);
137 + return;
133138 }
134139 })();
135140 } else {
136141 log.info(

Built with git-ssb-web