Perl code snippet:
=>
# Now add DCR to the task.
my $ret;
print "Before \n";
$ret = $G_TASK->AddFile($srcDcr, "Data record for file $file");
print "After \n";
push
@allFiles, $file;
&debug($VERBOSE, "ADDFILE: Add to task DCR $srcDcr");
&debug($DEV, "files [$ret] = ".(join ', ', $G_TASK->GetFiles()) );
# BEGIN : test
&debug($DEV, "Return value AddFile() : [$ret]");
if ($ret eq '') {
my $taskError = '';
$taskError = $G_TASK->GetError();
if (!defined($taskError)) {
&debug($DEV, "Task AddFile() error occured: see log file");
} else {
&debug($DEV, "Task error : $taskError");
}
}
=>
If method AddFile() fails it prints the error message to the console when I start the workflow task from a console.
For example:
=>
bash-2.05$ ./wfAttachFiles.ipl -a 76664 76670 /default/main/intranet-dev/doogle/WORKAREA/content subsites/work-income/procedures-policies/jz-staging-test3.html
Before
The file templatedata/internet/procedure/data/subsites/work-income/procedures-policies/jz-staging-test3.dcr.xml is already locked by another task.
ERROR:02400: Object is being reserved by someone else
After
bash-2.05$
=>
However GetError() always returns undef.
See log snippet:
=>
Mon Jan 08 11:16:41 2007 ------------------------ Debug Logging Started ------------------------
Mon Jan 08 11:16:41 2007 COMMAND LINE: -a 76730 76736 /default/main/intranet-dev/doogle/WORKAREA/content subsites/work-income/procedures-policies/jz-staging-test3.html
Mon Jan 08 11:16:41 2007 Begin session [76730] [scriptName]
Mon Jan 08 11:16:41 2007 BEGIN 76730 script body.
Mon Jan 08 11:16:41 2007 Processing file -> [subsites/work-income/procedures-policies/jz-staging-test3.html]
Mon Jan 08 11:16:41 2007 source file -> [/.iwmnt/default/main/intranet-dev/doogle/WORKAREA/content/subsites/work-income/procedures-policies/jz-staging-test3.html]
Mon Jan 08 11:16:41 2007 vpath -> [/default/main/intranet-dev/doogle/WORKAREA/content/subsites/work-income/procedures-policies/jz-staging-test3.html]
Mon Jan 08 11:16:42 2007 ADDFILE: Add to task DCR templatedata/internet/procedure/data/subsites/work-income/procedures-policies/jz-staging-test3.dcr.xml
Mon Jan 08 11:16:42 2007 files [] = subsites/work-income/procedures-policies/jz-staging-test3.html, templatedata/internet/procedure/data/subsites/work-income/procedures-policies/jz-staging-test3.dcr.xml
Mon Jan 08 11:16:42 2007 Return value AddFile() : []
Mon Jan 08 11:16:42 2007 Task add file error occured: see log file
=>
Is there a way to get GetError() to return the error message printed to the console ?