Skip to content

Commit

Permalink
Enhanced error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederisk committed Nov 17, 2022
1 parent 9a5ba04 commit 19dd040
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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*') {
Expand All @@ -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 @"
Expand Down

0 comments on commit 19dd040

Please sign in to comment.