From 885969a6de6526d437e2fc383a0438d8fa170138 Mon Sep 17 00:00:00 2001 From: Adam Rudell Date: Wed, 16 Aug 2023 19:13:17 -0500 Subject: [PATCH] capture error --- src/modules/SdnDiag.Server/private/Get-VfpPortState.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/SdnDiag.Server/private/Get-VfpPortState.ps1 b/src/modules/SdnDiag.Server/private/Get-VfpPortState.ps1 index 023ece4..b33210f 100644 --- a/src/modules/SdnDiag.Server/private/Get-VfpPortState.ps1 +++ b/src/modules/SdnDiag.Server/private/Get-VfpPortState.ps1 @@ -28,6 +28,12 @@ function Get-VfpPortState { continue } + # if we have an error, then capture error and exit out of the function + if ($line -ilike "ERROR:*") { + $msg = $line.Replace('ERROR:','').Trim() + throw $msg + } + # split the line by the colon and trim the spaces $subValue = $line.Split(':').Trim() if ($subValue.Count -eq 2) {