Skip to content

Remove exception guards #839

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 4 commits into from
Apr 26, 2025
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
7 changes: 4 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 11 additions & 28 deletions src/debugger/godot3/debug_session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export class GodotDebugSession extends LoggingDebugSession {
public controller = new ServerController(this);
public debug_data = new GodotDebugData(this);
public sceneTree: SceneTreeProvider;
private exception = false;
private got_scope: Subject = new Subject();
private ongoing_inspections: bigint[] = [];
private previous_inspections: bigint[] = [];
Expand Down Expand Up @@ -88,7 +87,6 @@ export class GodotDebugSession extends LoggingDebugSession {
this.mode = "launch";

this.debug_data.projectPath = args.project;
this.exception = false;
await this.controller.launch(args);

this.sendResponse(response);
Expand All @@ -99,7 +97,6 @@ export class GodotDebugSession extends LoggingDebugSession {

this.mode = "attach";

this.exception = false;
await this.controller.attach(args);

this.sendResponse(response);
Expand All @@ -114,11 +111,9 @@ export class GodotDebugSession extends LoggingDebugSession {
}

protected continueRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments) {
if (!this.exception) {
response.body = { allThreadsContinued: true };
this.controller.continue();
this.sendResponse(response);
}
response.body = { allThreadsContinued: true };
this.controller.continue();
this.sendResponse(response);
}

protected async evaluateRequest(response: DebugProtocol.EvaluateResponse, args: DebugProtocol.EvaluateArguments) {
Expand Down Expand Up @@ -149,17 +144,13 @@ export class GodotDebugSession extends LoggingDebugSession {
}

protected nextRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments) {
if (!this.exception) {
this.controller.next();
this.sendResponse(response);
}
this.controller.next();
this.sendResponse(response);
}

protected pauseRequest(response: DebugProtocol.PauseResponse, args: DebugProtocol.PauseArguments) {
if (!this.exception) {
this.controller.break();
this.sendResponse(response);
}
this.controller.break();
this.sendResponse(response);
}

protected async scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments) {
Expand Down Expand Up @@ -234,17 +225,13 @@ export class GodotDebugSession extends LoggingDebugSession {
}

protected stepInRequest(response: DebugProtocol.StepInResponse, args: DebugProtocol.StepInArguments) {
if (!this.exception) {
this.controller.step();
this.sendResponse(response);
}
this.controller.step();
this.sendResponse(response);
}

protected stepOutRequest(response: DebugProtocol.StepOutResponse, args: DebugProtocol.StepOutArguments) {
if (!this.exception) {
this.controller.step_out();
this.sendResponse(response);
}
this.controller.step_out();
this.sendResponse(response);
}

protected terminateRequest(response: DebugProtocol.TerminateResponse, args: DebugProtocol.TerminateArguments) {
Expand Down Expand Up @@ -303,10 +290,6 @@ export class GodotDebugSession extends LoggingDebugSession {
this.sendResponse(response);
}

public set_exception(exception: boolean) {
this.exception = true;
}

public set_scopes(stackVars: GodotStackVars) {
this.all_scopes = [
undefined,
Expand Down
1 change: 0 additions & 1 deletion src/debugger/godot3/server_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ export class ServerController {
if (this.exception.length === 0) {
this.session.sendEvent(new StoppedEvent("breakpoint", 0));
} else {
this.session.set_exception(true);
this.session.sendEvent(new StoppedEvent("exception", 0, this.exception));
}
}
Expand Down
39 changes: 11 additions & 28 deletions src/debugger/godot4/debug_session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export class GodotDebugSession extends LoggingDebugSession {
public controller = new ServerController(this);
public debug_data = new GodotDebugData(this);
public sceneTree: SceneTreeProvider;
private exception = false;
private configuration_done: Subject = new Subject();
private mode: "launch" | "attach" | "" = "";

Expand Down Expand Up @@ -81,7 +80,6 @@ export class GodotDebugSession extends LoggingDebugSession {
this.mode = "launch";

this.debug_data.projectPath = args.project;
this.exception = false;
await this.controller.launch(args);

this.sendResponse(response);
Expand All @@ -94,7 +92,6 @@ export class GodotDebugSession extends LoggingDebugSession {
this.mode = "attach";

this.debug_data.projectPath = args.project;
this.exception = false;
await this.controller.attach(args);

this.sendResponse(response);
Expand All @@ -111,27 +108,21 @@ export class GodotDebugSession extends LoggingDebugSession {

protected continueRequest(response: DebugProtocol.ContinueResponse, args: DebugProtocol.ContinueArguments) {
log.info("continueRequest", args);
if (!this.exception) {
response.body = { allThreadsContinued: true };
this.controller.continue();
this.sendResponse(response);
}
response.body = { allThreadsContinued: true };
this.controller.continue();
this.sendResponse(response);
}

protected nextRequest(response: DebugProtocol.NextResponse, args: DebugProtocol.NextArguments) {
log.info("nextRequest", args);
if (!this.exception) {
this.controller.next();
this.sendResponse(response);
}
this.controller.next();
this.sendResponse(response);
}

protected pauseRequest(response: DebugProtocol.PauseResponse, args: DebugProtocol.PauseArguments) {
log.info("pauseRequest", args);
if (!this.exception) {
this.controller.break();
this.sendResponse(response);
}
this.controller.break();
this.sendResponse(response);
}

protected setBreakPointsRequest(
Expand Down Expand Up @@ -176,18 +167,14 @@ export class GodotDebugSession extends LoggingDebugSession {

protected stepInRequest(response: DebugProtocol.StepInResponse, args: DebugProtocol.StepInArguments) {
log.info("stepInRequest", args);
if (!this.exception) {
this.controller.step();
this.sendResponse(response);
}
this.controller.step();
this.sendResponse(response);
}

protected stepOutRequest(response: DebugProtocol.StepOutResponse, args: DebugProtocol.StepOutArguments) {
log.info("stepOutRequest", args);
if (!this.exception) {
this.controller.step_out();
this.sendResponse(response);
}
this.controller.step_out();
this.sendResponse(response);
}

protected terminateRequest(response: DebugProtocol.TerminateResponse, args: DebugProtocol.TerminateArguments) {
Expand Down Expand Up @@ -297,8 +284,4 @@ export class GodotDebugSession extends LoggingDebugSession {
log.info("evaluateRequest response", response);
this.sendResponse(response);
}

public set_exception(exception: boolean) {
this.exception = true;
}
}
1 change: 0 additions & 1 deletion src/debugger/godot4/server_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ export class ServerController {
if (this.exception.length === 0) {
this.session.sendEvent(new StoppedEvent("breakpoint", 0));
} else {
this.session.set_exception(true);
this.session.sendEvent(new StoppedEvent("exception", 0, this.exception));
}
}
Expand Down