You should at the very least log the error in the
catch
.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
catch
.
Session.QueryReceived
to ignore the error. It works for other situations such as when the script is unable to update the timestamp, but fails hard when the file is locked/open.
Try
/Catch
workaround seem valid, or do I run the risk of larger issues such as skipping over additional file/folders that were intended to be handled by the errored thread?
Session.QueryReceived
to ignore the errors, right?
< 2024-12-05 18:12:06.315 The process cannot access the file because it is being used by another process
. 2024-12-05 18:12:06.323 Answer: Skip
* 2024-12-05 18:12:06.323 (ESkipFile) Can't open file 'C:\Users\<redeacted>\test\New Microsoft Excel Worksheet.xlsx'.
* 2024-12-05 18:12:06.323 System Error. Code: 32.
* 2024-12-05 18:12:06.323 The process cannot access the file because it is being used by another process
. 2024-12-05 18:12:06.323 Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
. 2024-12-05 18:12:06.323 Session upkeep
. 2024-12-05 18:12:06.323 Looking for network events
. 2024-12-05 18:12:06.323 Timeout waiting for network events
(ESkipFile) [1] Script Aborted Abnormally.
(ESkipFile) [1] $difference.Resolve($syncSession, $transferOptions) # | Out-Null.
> 2024-12-05 18:12:06.439 Script: exit
Additional Error Info:
Error command : $difference.Resolve($syncSession, $transferOptions) # | Out-Null
Error message : Exception calling "Resolve" with "2" argument(s): "File not found"
| Out-Null
isn't normally commented out, but it was for this debugging session in hopes of giving me more info to track down what's going on.
Resolve
method in a try/catch loop, but would like to know if that more of a lame hack and if I'm just hiding the root cause that going to really bite me later. Suggestions?
try {
$difference.Resolve($syncSession, $transferOptions) | Out-Null
}
catch {
}