socket-function 1.2.29 → 1.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/CallFactory.ts +5 -5
- package/src/misc.ts +5 -1
package/package.json
CHANGED
package/src/CallFactory.ts
CHANGED
|
@@ -316,7 +316,7 @@ export async function createCallFactory(
|
|
|
316
316
|
registerOnce();
|
|
317
317
|
callFactory.receivedInitializeState = undefined;
|
|
318
318
|
|
|
319
|
-
function onClose(
|
|
319
|
+
function onClose(message: string) {
|
|
320
320
|
// We try various connections, and if they fail, we will just try other node IDs until we finally do connect, and then we stick with that nodeId, and when it disconnects we need to handle disconnections normally.
|
|
321
321
|
if (skipCloseHandling && !hasEverConnected) {
|
|
322
322
|
return;
|
|
@@ -335,7 +335,7 @@ export async function createCallFactory(
|
|
|
335
335
|
call.callback({
|
|
336
336
|
isReturn: true,
|
|
337
337
|
result: undefined,
|
|
338
|
-
error:
|
|
338
|
+
error: `Call failed for ${call.call.classGuid}.${call.call.functionName}: ${message}`,
|
|
339
339
|
seqNum: call.call.seqNum,
|
|
340
340
|
});
|
|
341
341
|
}
|
|
@@ -353,12 +353,12 @@ export async function createCallFactory(
|
|
|
353
353
|
// NOTE: No more logging, as we throw, so the caller should be logging the
|
|
354
354
|
// error (or swallowing it, if that is what it wants to do).
|
|
355
355
|
//console.log(`Websocket error for ${niceConnectionName}`, e.message);
|
|
356
|
-
onClose(
|
|
356
|
+
onClose(`Connection error for ${niceConnectionName}: ${e.message}`);
|
|
357
357
|
});
|
|
358
358
|
|
|
359
359
|
newWebSocket.addEventListener("close", async () => {
|
|
360
360
|
//console.log(`Websocket closed ${niceConnectionName}`);
|
|
361
|
-
onClose(
|
|
361
|
+
onClose(`Connection closed to ${niceConnectionName}`);
|
|
362
362
|
});
|
|
363
363
|
|
|
364
364
|
newWebSocket.addEventListener("message", onMessage);
|
|
@@ -381,7 +381,7 @@ export async function createCallFactory(
|
|
|
381
381
|
callFactory.isConnected = true;
|
|
382
382
|
hasEverConnected = true;
|
|
383
383
|
} else {
|
|
384
|
-
onClose(
|
|
384
|
+
onClose(`Websocket received in closed state`);
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
if (callFactory.lastClosed && callFactory.isConnected) {
|
package/src/misc.ts
CHANGED
|
@@ -15,7 +15,11 @@ export type Watchable<T> = (callback: (value: T) => void) => MaybePromise<void>;
|
|
|
15
15
|
export function convertErrorStackToError(error: string): Error {
|
|
16
16
|
let errorObj = new Error();
|
|
17
17
|
errorObj.stack = String(error);
|
|
18
|
-
|
|
18
|
+
let message = String(error).split("\n")[0];
|
|
19
|
+
if (message.startsWith("Error: ")) {
|
|
20
|
+
message = message.slice("Error: ".length);
|
|
21
|
+
}
|
|
22
|
+
errorObj.message = message;
|
|
19
23
|
return errorObj;
|
|
20
24
|
}
|
|
21
25
|
|