Skip to content
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
8 changes: 4 additions & 4 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ async function clearScene() {
await ManimShell.instance.executeCommandErrorOnNoActiveSession("clear()");
} catch (error) {
if (error instanceof NoActiveShellError) {
Window.showErrorMessage('No active Manim session found to remove objects from.');
} else {
Logger.error(`💥 Error while trying to remove objects from scene: ${error}`);
throw error;
Window.showWarningMessage('No active Manim session found to remove objects from.');
return;
}
Logger.error(`💥 Error while trying to remove objects from scene: ${error}`);
throw error;
}
}

Expand Down
13 changes: 11 additions & 2 deletions src/manimShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ export class ManimShell {
return;
}

if (errorOnNoActiveShell && !this.hasActiveShell()) {
throw new NoActiveShellError();
if (errorOnNoActiveShell) {
this.errorOnNoActiveShell();
}

if (this.isExecutingCommand) {
Expand Down Expand Up @@ -312,6 +312,15 @@ export class ManimShell {
}
}

/**
* Errors if no active shell is found.
*/
public errorOnNoActiveShell() {
if (!this.hasActiveShell()) {
throw new NoActiveShellError();
}
}

/**
* This command should only be used from within the actual `startScene()`
* method. It starts a new ManimGL scene in the terminal and waits until
Expand Down
12 changes: 11 additions & 1 deletion src/startStopScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,15 @@ export async function startScene(lineStart?: number) {
* See `forceQuitActiveShell()` for more details.
*/
export async function exitScene() {
await ManimShell.instance.forceQuitActiveShell();
try {
ManimShell.instance.errorOnNoActiveShell();
await ManimShell.instance.forceQuitActiveShell();
} catch (error) {
if (error instanceof NoActiveShellError) {
Window.showWarningMessage("No active Manim session found to quit.");
return;
}
Logger.error(`💥 Error while trying to exit the scene: ${error}`);
throw error;
}
}