File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1736,6 +1736,7 @@ function Stage-BuildArtifacts($Arch) {
1736
1736
}
1737
1737
1738
1738
# -------------------------------------------------------------------
1739
+ try {
1739
1740
1740
1741
if (-not $SkipBuild ) {
1741
1742
Fetch- Dependencies
@@ -1829,3 +1830,31 @@ if ($Test -contains "dispatch") { Build-Dispatch $HostArch -Test }
1829
1830
if ($Test -contains " foundation" ) { Build-Foundation $HostArch - Test }
1830
1831
if ($Test -contains " xctest" ) { Build-XCTest $HostArch - Test }
1831
1832
if ($Test -contains " llbuild" ) { Build-LLBuild $HostArch - Test }
1833
+
1834
+ # Custom exception printing for more detailed exception information
1835
+ } catch {
1836
+ function Write-ErrorLines ($Text , $Indent = 0 ) {
1837
+ $IndentString = " " * $Indent
1838
+ $Text.Replace (" `r " , " " ) -split " `n " | ForEach-Object {
1839
+ Write-Host " $IndentString $_ " - ForegroundColor Red
1840
+ }
1841
+ }
1842
+
1843
+ Write-ErrorLines " Error: $_ "
1844
+ Write-ErrorLines $_.ScriptStackTrace - Indent 4
1845
+
1846
+ # Walk the .NET inner exception chain to print all messages and stack traces
1847
+ $Exception = $_.Exception
1848
+ $Indent = 2
1849
+ while ($Exception -is [Exception ]) {
1850
+ Write-ErrorLines " From $ ( $Exception.GetType ().FullName) : $ ( $Exception.Message ) " - Indent $Indent
1851
+ if ($null -ne $Exception.StackTrace ) {
1852
+ # .NET exceptions stack traces are already indented by 3 spaces
1853
+ Write-ErrorLines $Exception.StackTrace - Indent ($Indent + 1 )
1854
+ }
1855
+ $Exception = $Exception.InnerException
1856
+ $Indent += 2
1857
+ }
1858
+
1859
+ exit 1
1860
+ }
You can’t perform that action at this time.
0 commit comments