MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / handleCaughtError

Function handleCaughtError

local-cli/server/util/messageSocket.js:94–121  ·  view source on GitHub ↗
(message, error)

Source from the content-addressed store, hash-verified

92 const clientId = `client#${nextClientId++}`;
93
94 function handleCaughtError(message, error) {
95 const errorMessage = {
96 id: message.id,
97 method: message.method,
98 target: message.target,
99 error: message.error === undefined ? 'undefined' : 'defined',
100 params: message.params === undefined ? 'undefined' : 'defined',
101 result: message.result === undefined ? 'undefined' : 'defined',
102 };
103
104 if (message.id === undefined) {
105 console.error(
106 `Handling message from ${clientId} failed with:\n${error}\n` +
107 `message:\n${JSON.stringify(errorMessage)}`);
108 } else {
109 try {
110 clientWs.send(JSON.stringify({
111 version: PROTOCOL_VERSION,
112 error: error,
113 id: message.id,
114 }));
115 } catch (e) {
116 console.error(`Failed to reply to ${clientId} with error:\n${error}` +
117 `\nmessage:\n${JSON.stringify(errorMessage)}` +
118 `\ndue to error: ${e.toString()}`);
119 }
120 }
121 }
122
123 function handleServerRequest(message) {
124 let result = null;

Callers 1

attachToServerFunction · 0.85

Calls 3

errorMethod · 0.65
sendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…