From b77218b387b9c31a109a316be98a55ca107ee1d9 Mon Sep 17 00:00:00 2001
From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
Date: Sun, 18 Feb 2018 14:11:18 +0100
Subject: [PATCH] Make Get-WriteTime throw an exception if file can't be found.

---
 Updater/Update-Service.ps1 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Updater/Update-Service.ps1 b/Updater/Update-Service.ps1
index c73d2ab..5c9d569 100644
--- a/Updater/Update-Service.ps1
+++ b/Updater/Update-Service.ps1
@@ -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)"
-- 
GitLab