When should I use Write-Error vs. Throw? Terminating vs. non-terminating errors

前端 未结 6 1681
别跟我提以往
别跟我提以往 2020-11-28 03:55

Looking at a Get-WebFile script over on PoshCode, http://poshcode.org/3226, I noticed this strange-to-me contraption:

$URL_Format_Error = [string]\"...\"
Wri         


        
6条回答
  •  无人及你
    2020-11-28 04:29

    If your reading of the code is correct then you are correct. Terminating errors should use throw, and if you're dealing with .NET types then it is helpful to also follow .NET exception conventions.

提交回复
热议问题