Skip to content

Commit 502eed0

Browse files
committed
Add default switch case to handle unknown actions
1 parent 22c5e53 commit 502eed0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/powershell/maintenance.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
param(
22
[string]$BaseInstallPath = "C:\Program Files\NHS\ManageBreastScreeningGateway",
3-
[ValidateSet("BackupPACSDatabase","BackupMWLDatabase","RotateLogs")]
3+
[Parameter(Mandatory)]
44
[string]$Action
55
)
66

@@ -79,6 +79,7 @@ function Start-AllServices {
7979
}
8080

8181
Write-Log "$($svc.Name) started in $([math]::Round($stopwatch.Elapsed.TotalSeconds, 1))s." "SUCCESS"
82+
}
8283
}
8384

8485
# -- Database backup ----------------------------------------------------------
@@ -219,6 +220,10 @@ switch ($Action) {
219220
Start-AllServices -Services $Services -TimeoutSeconds $startStopTimeoutSeconds
220221
}
221222

223+
default {
224+
Write-Log "Unknown action: $Action" "ERROR"
225+
throw "Unknown action: $Action"
226+
}
222227
}
223228

224229
exit 0

0 commit comments

Comments
 (0)