Skip to content

Improved the description of the error shown when a previous debugger is closed when a new one is opened #51296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions packages/dev-middleware/src/inspector-proxy/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ const WS_CLOSURE_CODE = {
INTERNAL_ERROR: 1011,
};

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

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

this.#deviceEventReporter?.logConnection('debugger', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const MIN_EVENT_LOOP_DELAY_PERCENT_TO_REPORT = 20;
const INTERNAL_ERROR_CODE = 1011;

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