@@ -316,14 +316,15 @@ export function validateAndGetTaskId(id: any): number {
316316 }
317317
318318 if ( isStringOfAtLeast1Len ( id ) ) {
319-
320- id = tryIntConversion ( id , " Task id is invalid" ) ;
319+ const idStr = isObject ( id ) ? JSON . stringify ( id ) : id ;
320+ id = tryIntConversion ( id , ` Task id ' ${ idStr } ' is invalid.` ) ;
321321
322322 }
323323
324324
325325 if ( ! isValidId ( id ) ) {
326- throw new JsonHTTPResponseWithMessage ( "Task id is invalid" ) ;
326+ const idStr = isObject ( id ) ? JSON . stringify ( id ) : id ;
327+ throw new JsonHTTPResponseWithMessage ( `Task id '${ idStr } ' is invalid.` ) ;
327328 }
328329
329330 return id ;
@@ -340,7 +341,8 @@ export function validatePatchTask(jsonData: any): number[] {
340341 }
341342
342343 if ( ! isListOfValidIds ( taskIds ) ) {
343- throw new JsonHTTPResponseWithMessage ( "'task_ids' must be a list of integers" ) ;
344+ const taskIdsStr = isObject ( taskIds ) || Array . isArray ( taskIds ) ? JSON . stringify ( taskIds ) : taskIds ;
345+ throw new JsonHTTPResponseWithMessage ( `'task_ids' with value '${ taskIdsStr } ' must be a list of integers representing scraping task ids.` ) ;
344346 }
345347
346348 return taskIds ;
@@ -365,11 +367,12 @@ export function validateUiPatchTask(jsonData: any): [string, number[]] {
365367 }
366368
367369 if ( isNullish ( taskIds ) ) {
368- throw new JsonHTTPResponseWithMessage ( "'task_ids' must be provided" ) ;
370+ throw new JsonHTTPResponseWithMessage ( "'task_ids' must be provided. Task IDs are unique identifiers for scraping tasks. " ) ;
369371 }
370372
371373 if ( ! isListOfValidIds ( taskIds ) ) {
372- throw new JsonHTTPResponseWithMessage ( "'task_ids' must be a list of integers" ) ;
374+ const taskIdsStr = isObject ( taskIds ) || Array . isArray ( taskIds ) ? JSON . stringify ( taskIds ) : taskIds ;
375+ throw new JsonHTTPResponseWithMessage ( `'task_ids' with value '${ taskIdsStr } ' must be a list of integers representing scraping tasks.` ) ;
373376 }
374377
375378 return [ action , taskIds ] ;
0 commit comments