File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ Resumes a task from history.
4141
4242- ` data ` : Task ID to resume (string)
4343
44+ ** Error Handling:**
45+
46+ - If the task ID is not found in history, the command will fail gracefully without crashing the IPC server
47+ - Errors are logged for debugging purposes but do not propagate to the client
48+
4449## Usage Example
4550
4651``` typescript
Original file line number Diff line number Diff line change @@ -15,6 +15,25 @@ describe("IPC Types", () => {
1515 expect ( actualCommands ) . toContain ( command )
1616 } )
1717 } )
18+
19+ describe ( "Error Handling" , ( ) => {
20+ it ( "should handle ResumeTask command gracefully when task not found" , ( ) => {
21+ // This test verifies the schema validation - the actual error handling
22+ // for invalid task IDs is tested at the API level, not the schema level
23+ const resumeTaskCommand = {
24+ commandName : TaskCommandName . ResumeTask ,
25+ data : "non-existent-task-id" ,
26+ }
27+
28+ const result = taskCommandSchema . safeParse ( resumeTaskCommand )
29+ expect ( result . success ) . toBe ( true )
30+
31+ if ( result . success ) {
32+ expect ( result . data . commandName ) . toBe ( "ResumeTask" )
33+ expect ( result . data . data ) . toBe ( "non-existent-task-id" )
34+ }
35+ } )
36+ } )
1837 } )
1938
2039 describe ( "taskCommandSchema" , ( ) => {
Original file line number Diff line number Diff line change @@ -80,7 +80,14 @@ export class API extends EventEmitter<RooCodeEvents> implements RooCodeAPI {
8080 break
8181 case TaskCommandName . ResumeTask :
8282 this . log ( `[API] ResumeTask -> ${ data } ` )
83- await this . resumeTask ( data )
83+ try {
84+ await this . resumeTask ( data )
85+ } catch ( error ) {
86+ const errorMessage = error instanceof Error ? error . message : String ( error )
87+ this . log ( `[API] ResumeTask failed for taskId ${ data } : ${ errorMessage } ` )
88+ // Don't rethrow - we want to prevent IPC server crashes
89+ // The error is logged for debugging purposes
90+ }
8491 break
8592 }
8693 } )
You can’t perform that action at this time.
0 commit comments