You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/rce.ts
+18-3Lines changed: 18 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -47,6 +47,10 @@ export interface RceRequest {
47
47
* Disposable events
48
48
*/
49
49
cancelEvents?: vscode.Disposable[]
50
+
/**
51
+
* The action data associated with this request.
52
+
*/
53
+
actionData: ActionData;
50
54
}
51
55
52
56
exportconstcancelRequestAction: RCEAction={
@@ -103,10 +107,13 @@ export function clearRceRequest(): void {
103
107
* Creates a new RCE request and attaches it to NEURO.
104
108
* @param prompt The prompt to be displayed in the notification.
105
109
* @param callback The callback function to be executed when the request is accepted.
110
+
* @param actionData The action data associated with this request.
111
+
* @param cancelEvents Optional array of disposables for cancellation events.
106
112
*/
107
113
exportfunctioncreateRceRequest(
108
114
prompt: string,
109
115
callback: ()=>string|undefined,
116
+
actionData: ActionData,
110
117
cancelEvents?: vscode.Disposable[],
111
118
): void{
112
119
NEURO.rceRequest={
@@ -118,6 +125,7 @@ export function createRceRequest(
118
125
resolve: ()=>{},
119
126
attachNotification: async()=>{},
120
127
cancelEvents,
128
+
actionData,
121
129
};
122
130
123
131
constpromise=newPromise<void>((resolve)=>{
@@ -220,9 +228,15 @@ export function acceptRceRequest(): void {
220
228
221
229
NEURO.client?.sendContext('Vedal has accepted your request.');
222
230
223
-
constresult=NEURO.rceRequest.callback();
224
-
if(result)
225
-
NEURO.client?.sendContext(result);
231
+
try{
232
+
constresult=NEURO.rceRequest.callback();
233
+
if(result)
234
+
NEURO.client?.sendContext(result);
235
+
}catch(erm: unknown){
236
+
constactionName=NEURO.rceRequest.actionData.name;
237
+
notifyOnCaughtException(actionName,erm);
238
+
NEURO.client?.sendActionResult(NEURO.rceRequest.actionData.id,true,`An error occured while executing the action "${actionName}". You can retry if you like, but it may be better to ask Vedal to check what's up.`);
0 commit comments