From 19dd0407f6c6169087df150206fab14d9048636b Mon Sep 17 00:00:00 2001 From: Rowe Wilson Frederisk Holme Date: Fri, 18 Nov 2022 06:08:12 +0800 Subject: [PATCH] Enhanced error handling --- action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index cf99c38..87ef23c 100644 --- a/action.yml +++ b/action.yml @@ -109,7 +109,7 @@ runs: [String]$status = (kaggle kernels status $kernelName 2>&1) -join ' '; # error if ($status -like '*error*') { - throw [Exception]::new('FAIL: Test(s) failed.'); + throw [System.Management.Automation.ApplicationFailedException]::new('FAIL: Test(s) failed.'); } # cancel elseif ($status -like '*cancel*') { @@ -126,7 +126,8 @@ runs: } } } - catch { + catch [System.Management.Automation.ApplicationFailedException], [OperationCanceledException] { + # write log kaggle kernels output $kernelName; [String]$fullMessage = (Get-Content -Path ($kernelName + '.log') -Raw | ConvertFrom-Json -AsHashtable | ForEach-Object -Process { $_['data'] }) -join ''; Write-Host -Object @"