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

Commit

Permalink
Object logging in all cases - Fix #145
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jan 20, 2017
1 parent e06f6f7 commit 5715d40
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -697,20 +697,15 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
protected onConsoleAPICalled(params: Crdp.Runtime.ConsoleAPICalledEvent): void {
const result = formatConsoleArguments(params);
const category = result.isError ? 'stderr' : 'stdout';
if (result.args.length === 1 && result.args[0].type === 'string') {
const e = new OutputEvent(result.args[0].value, category);
this._session.sendEvent(e);
} else {
this.logObjects(result.args, category);
}
this.logObjects(result.args, category);
}

protected onExceptionThrown(params: Crdp.Runtime.ExceptionThrownEvent): void {
this.logObjects([params.exceptionDetails.exception], 'stderr');
}

private logObjects(objs: Crdp.Runtime.RemoteObject[], category: string): void {
const e: DebugProtocol.OutputEvent = new OutputEvent('foo', category);
const e: DebugProtocol.OutputEvent = new OutputEvent('', category);
e.body.variablesReference = this._variableHandles.create(new Variables.LoggedObjects(objs), 'repl');
this._session.sendEvent(e);
}
Expand Down Expand Up @@ -1161,6 +1156,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
}

public variables(args: DebugProtocol.VariablesArguments): Promise<IVariablesResponseBody> {
if (!this.chrome) {
return utils.errP(errors.runtimeNotConnectedMsg);
}

const handle = this._variableHandles.get(args.variablesReference);
if (!handle) {
return Promise.resolve<IVariablesResponseBody>(undefined);
Expand Down

0 comments on commit 5715d40

Please sign in to comment.