Skip to content
Snippets Groups Projects
Commit b77218b3 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Make Get-WriteTime throw an exception if file can't be found.

parent 6e2f285b
No related branches found
No related tags found
No related merge requests found
......@@ -139,6 +139,11 @@ function Get-WriteTime([string]$FileName) {
try {
$TimeStamp = (Get-Item "$FileName" -EA Stop).LastWriteTime
}
catch [System.Management.Automation.ItemNotFoundException] {
Write-Verbose "File [$($FileName)] can't be found!"
throw [System.Management.Automation.ItemNotFoundException] `
"File not found: $($FileName)."
}
catch {
$ex = $_.Exception.Message
Log-Error "Error determining file age of [$($FileName)]!`n$($ex)"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment