Skip to content

fix: suggest manual app start instead of crashing on ios debug socket connection errors #4258

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

Merged
merged 1 commit into from
Jan 5, 2019
Merged
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
12 changes: 7 additions & 5 deletions lib/device-sockets/ios/app-debug-socket-proxy-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,23 @@ export class AppDebugSocketProxyFactory extends EventEmitter implements IAppDebu
const server = new ws.Server(<any>{
port: localPort,
host: "localhost",
verifyClient: async (info: any, callback: Function) => {
verifyClient: async (info: any, callback: (res: boolean, code?: number, message?: string) => void) => {
let acceptHandshake = true;
this.$logger.info("Frontend client connected.");
let appDebugSocket;
try {
appDebugSocket = await device.getDebugSocket(appId);
this.$logger.info("Backend socket created.");
info.req["__deviceSocket"] = appDebugSocket;
} catch (err) {
err.deviceIdentifier = device.deviceInfo.identifier;
this.$logger.trace(err);
this.emit(CONNECTION_ERROR_EVENT_NAME, err);
this.$errors.failWithoutHelp(`Cannot connect to device socket.The error message is ${err.message} `);
acceptHandshake = false;
this.$logger.warn(`Cannot connect to device socket. The error message is '${err.message}'. Try starting the application manually.`);
}

this.$logger.info("Backend socket created.");
info.req["__deviceSocket"] = appDebugSocket;
callback(true);
callback(acceptHandshake);
}
});
this.deviceWebServers[cacheKey] = server;
Expand Down