By William Jeffrey Rankin, Thu Sep 19 2024
As of revision 157 (released Sep 18, 2024) Hua outputs specific codes based upon error condition. Normally, if all goes well, Hua exits with a status of 0
. But when an error condition results, Hua outputs a message and, depending upon the severity of the error, either continues processing content or stops entirely. When the latter occurs, a non-zero exit status is generated. It can be output as seen in the examples below.
jeffr@CALLISTO: D:\Documents\wjr-blog $ ..\Hua\hua.ps1 .\wrong.cfg
Config file error. Config file path specified as .\wrong.cfg . Quitting.
jeffr@CALLISTO: D:\Documents\wjr-blog $ $LASTEXITCODE
2
jeffr@Phobos: ~/Hua $ pwsh ./hua.ps1 hua.cfg
Meta info file error. Meta file path set as .\met.csv. Quitting.
jeffr@Phobos: ~/Hua $ echo $?
9
This is useful in instances where Hua is invoked from a script or as part of a toolchain and exit status needs to be introspected. For more information, refer to the Errors section of the main Hua page.