Make timeouts show an error message instead of success

This commit is contained in:
Ivan 2026-06-01 09:17:15 +02:00
parent b8c899bdbe
commit 1118b80ccf
3 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{
"id": "csharp-snippet-runner",
"name": "CSharp Snippet Runner",
"version": "1.0.3",
"version": "1.0.4",
"minAppVersion": "1.12.7",
"description": "Run C# code blocks using an auto-installed CSharpRepl runtime.",
"author": "OHM Engineering",

View file

@ -283,7 +283,11 @@ export default class CSharpSnippetRunnerPlugin extends Plugin {
clearTimeout(timeoutHandle);
if (timedOut) {
resolve({ stdout, stderr });
const timeoutError = new Error(`CSharpRepl execution timed out after ${timeoutMs}ms. Increase the timeout setting and try again.`) as ReplExecutionError;
timeoutError.code = 'ETIMEDOUT';
timeoutError.stdout = stdout;
timeoutError.stderr = stderr;
reject(timeoutError);
return;
}

View file

@ -6,7 +6,7 @@ export interface CSharpSnippetSettings {
}
export const DEFAULT_SETTINGS: CSharpSnippetSettings = {
executionTimeoutMs: 3000,
executionTimeoutMs: 10000,
};
export class CSharpSnippetSettingTab extends PluginSettingTab {
@ -29,7 +29,7 @@ export class CSharpSnippetSettingTab extends PluginSettingTab {
.setName('Execution timeout (ms)')
.setDesc('Maximum time to wait before stopping execution and returning captured output.')
.addText((text) => text
.setPlaceholder('3000')
.setPlaceholder('10000')
.setValue(String(this.plugin.settings.executionTimeoutMs))
.onChange(async (value) => {
const parsed = Number.parseInt(value, 10);