File tree Expand file tree Collapse file tree
packages/dev-middleware/src/inspector-proxy Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ const WS_CLOSURE_CODE = {
4444} ;
4545
4646export const WS_CLOSE_REASON = {
47- PAGE_NOT_FOUND : 'Debugger Page Not Found' ,
48- DEVICE_DISCONNECTED : 'Corresponding Device Disconnected ' ,
49- RECREATING_DEVICE : 'Recreating Device Connection' ,
50- RECREATING_DEBUGGER : 'Recreating Debugger Connection' ,
47+ PAGE_NOT_FOUND : '[PAGE_NOT_FOUND] Debugger Page Not Found' ,
48+ 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' ,
5151} ;
5252
5353// Prefix for script URLs that are alphanumeric IDs. See comment in #processMessageFromDeviceLegacy method for
@@ -219,7 +219,7 @@ export default class Device {
219219 // Device disconnected - close debugger connection.
220220 this . #terminateDebuggerConnection(
221221 WS_CLOSURE_CODE . NORMAL ,
222- WS_CLOSE_REASON . DEVICE_DISCONNECTED ,
222+ WS_CLOSE_REASON . CONNECTION_LOST ,
223223 ) ;
224224 clearInterval ( this . #pagesPollingIntervalId) ;
225225 }
Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ const MIN_EVENT_LOOP_DELAY_PERCENT_TO_REPORT = 20;
4747
4848const INTERNAL_ERROR_CODE = 1011 ;
4949
50+ // should be aligned with
51+ // https://github.com/facebook/react-native-devtools-frontend/blob/fa273092fbc8edc94d4a0a3621735f4677a99ba8/front_end/ui/legacy/components/utils/TargetDetachedDialog.ts#L50
52+ const INTERNAL_ERROR_MESSAGES = {
53+ UREGISTERED_DEVICE :
54+ '[UREGISTERED_DEVICE] Debugger connection attempted for a device that was not registered' ,
55+ INCORRECT_URL :
56+ '[INCORRECT_URL] Incorrect URL - device and page IDs must be provided' ,
57+ } ;
58+
5059export type GetPageDescriptionsConfig = {
5160 requestorRelativeBaseUrl : URL ,
5261 logNoPagesForConnectedDevice ?: boolean ,
@@ -507,13 +516,11 @@ export default class InspectorProxy implements InspectorProxyQueries {
507516
508517 try {
509518 if ( deviceId == null || pageId == null ) {
510- throw new Error ( 'Incorrect URL - must provide device and page IDs' ) ;
519+ throw new Error ( INTERNAL_ERROR_MESSAGES . INCORRECT_URL ) ;
511520 }
512521
513522 if ( device == null ) {
514- throw new Error (
515- 'Debugger connection attempted for a non registered device' ,
516- ) ;
523+ throw new Error ( INTERNAL_ERROR_MESSAGES . UREGISTERED_DEVICE ) ;
517524 }
518525
519526 this . #logger?. info (
You can’t perform that action at this time.
0 commit comments