add a little more details to execution exceptions

This commit is contained in:
LenAnderson
2024-07-05 18:05:22 -04:00
parent b1412d3bce
commit 91ffd141ef
3 changed files with 101 additions and 3 deletions

View File

@ -7,6 +7,7 @@ import { SlashCommandBreakController } from './SlashCommandBreakController.js';
import { SlashCommandBreakPoint } from './SlashCommandBreakPoint.js';
import { SlashCommandClosureResult } from './SlashCommandClosureResult.js';
import { SlashCommandDebugController } from './SlashCommandDebugController.js';
import { SlashCommandExecutionError } from './SlashCommandExecutionError.js';
import { SlashCommandExecutor } from './SlashCommandExecutor.js';
import { SlashCommandNamedArgumentAssignment } from './SlashCommandNamedArgumentAssignment.js';
import { SlashCommandScope } from './SlashCommandScope.js';
@ -370,7 +371,11 @@ export class SlashCommandClosure {
if (this.debugController) {
this.debugController.isStepping = false || this.debugController.isSteppingInto;
}
this.scope.pipe = await executor.command.callback(args, value ?? '');
try {
this.scope.pipe = await executor.command.callback(args, value ?? '');
} catch (ex) {
throw new SlashCommandExecutionError(ex, ex.message, executor.name, executor.start, executor.end, this.fullText.slice(executor.start, executor.end), this.fullText);
}
if (this.debugController) {
this.debugController.namedArguments = undefined;
this.debugController.unnamedArguments = undefined;