Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Small fixes #326

Merged
merged 1 commit into from
May 5, 2018
Merged
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
13 changes: 6 additions & 7 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2140,9 +2140,8 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
} else {
return this.remoteObjectToVariable(propDesc.name, response.result, parentEvaluateName);
}
},
error => {
logger.error('Error evaluating getter - ' + error.toString());
}).catch(error => {
logger.error(`Error evaluating getter for '${propDesc.name}' - ${error.toString()}`);
return { name: propDesc.name, value: error.toString(), variablesReference: 0 };
});
} else if (propDesc.set) {
Expand Down Expand Up @@ -2541,19 +2540,19 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
error => Promise.reject<string>(errors.errorFromEvaluate(error.message)));
}

public remoteObjectToVariable(name: string, object: Crdp.Runtime.RemoteObject, parentEvaluateName?: string, stringify = true, context: VariableContext = 'variables'): Promise<DebugProtocol.Variable> {
public async remoteObjectToVariable(name: string, object: Crdp.Runtime.RemoteObject, parentEvaluateName?: string, stringify = true, context: VariableContext = 'variables'): Promise<DebugProtocol.Variable> {
name = name || '""';

if (object) {
if (object.type === 'object') {
return this.createObjectVariable(name, object, parentEvaluateName, context);
} else if (object.type === 'function') {
return Promise.resolve(this.createFunctionVariable(name, object, context, parentEvaluateName));
return this.createFunctionVariable(name, object, context, parentEvaluateName);
} else {
return Promise.resolve(this.createPrimitiveVariable(name, object, parentEvaluateName, stringify));
return this.createPrimitiveVariable(name, object, parentEvaluateName, stringify);
}
} else {
return Promise.resolve(this.createPrimitiveVariableWithValue(name, '', parentEvaluateName));
return this.createPrimitiveVariableWithValue(name, '', parentEvaluateName);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/chrome/chromeDebugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export class ChromeDebugSession extends LoggingDebugSession implements IObservab
telemetry.reportEvent(ErrorTelemetryEventName, properties);
};

// While using the debug adapter in a debug server, we create several connections. To prevent accumulating listeners we remove existing listeners before adding new ones
process.removeAllListeners('uncaughtException');
process.removeAllListeners('unhandledRejection');

process.on('uncaughtException', (err: any) => {
reportErrorTelemetry(err, 'uncaughtException');

Expand Down