mirror of
https://github.com/ohm-engineering/obsidian-csharp-interactive.git
synced 2026-07-22 07:24:31 +00:00
Make timeouts show an error message instead of success
This commit is contained in:
parent
b8c899bdbe
commit
1118b80ccf
3 changed files with 8 additions and 4 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue