Skip to content

Commit 347fe50

Browse files
vzaidmanfacebook-github-bot
authored andcommitted
Improved the description of the error shown when a previous debugger is closed when a new one is opened (#51296)
Summary: Changelog: [General][Internal] Improved the description of the error shown when a previous debugger is closed when a new one is opened Corresponding DevTools PR: facebook/react-native-devtools-frontend#162 Reviewed By: hoxyq Differential Revision: D74657572
1 parent 7776122 commit 347fe50

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/dev-middleware/src/inspector-proxy/Device.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ const WS_CLOSURE_CODE = {
4343
INTERNAL_ERROR: 1011,
4444
};
4545

46+
// should be aligned with
47+
// https://github.com/facebook/react-native-devtools-frontend/blob/3d17e0fd462dc698db34586697cce2371b25e0d3/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts#L50-L64
4648
export const WS_CLOSE_REASON = {
47-
PAGE_NOT_FOUND: '[PAGE_NOT_FOUND] Debugger Page Not Found',
49+
PAGE_NOT_FOUND: '[PAGE_NOT_FOUND] Debugger page not found',
4850
CONNECTION_LOST: '[CONNECTION_LOST] Connection lost to corresponding device',
49-
RECREATING_DEVICE: '[RECREATING_DEVICE] Recreating Device Connection',
50-
RECREATING_DEBUGGER: '[RECREATING_DEBUGGER] Recreating Debugger Connection',
51+
RECREATING_DEVICE: '[RECREATING_DEVICE] Recreating device connection',
52+
NEW_DEBUGGER_OPENED:
53+
'[NEW_DEBUGGER_OPENED] New debugger opened for the same app instance',
5154
};
5255

5356
// Prefix for script URLs that are alphanumeric IDs. See comment in #processMessageFromDeviceLegacy method for
@@ -336,7 +339,7 @@ export default class Device {
336339
// Disconnect current debugger if we already have debugger connected.
337340
this.#terminateDebuggerConnection(
338341
WS_CLOSURE_CODE.NORMAL,
339-
WS_CLOSE_REASON.RECREATING_DEBUGGER,
342+
WS_CLOSE_REASON.NEW_DEBUGGER_OPENED,
340343
);
341344

342345
this.#deviceEventReporter?.logConnection('debugger', {

packages/dev-middleware/src/inspector-proxy/InspectorProxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const MIN_EVENT_LOOP_DELAY_PERCENT_TO_REPORT = 20;
4848
const INTERNAL_ERROR_CODE = 1011;
4949

5050
// should be aligned with
51-
// https://github.com/facebook/react-native-devtools-frontend/blob/fa273092fbc8edc94d4a0a3621735f4677a99ba8/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts#L50
51+
// https://github.com/facebook/react-native-devtools-frontend/blob/3d17e0fd462dc698db34586697cce2371b25e0d3/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts#L50-L64
5252
const INTERNAL_ERROR_MESSAGES = {
5353
UREGISTERED_DEVICE:
5454
'[UREGISTERED_DEVICE] Debugger connection attempted for a device that was not registered',

0 commit comments

Comments
 (0)