A ParseError is generated if "The Try statement is missing its Catch or Finally block" works only one way." but not vice versa: if "The Catch or Finally statement is missing its Try block".
See also: PowerShell/PSScriptAnalyzer#2098
Expected behavior
A simular behavior for both situations, meaning:
An error when invokeing the following script:
Invoke-ScriptAnalyzer -ScriptDefinition {function Test { Catch { write-verbose 'Test' } }}.ToString()
Or visa verse (no errors at alll), knowing that a standalone Try (e.g.: $a = try { 1 / $b }) makes more sense than a standalone Catch.
Actual behavior
Different behavior on the symmetrical situation.
Environment data
A ParseError is generated if "The Try statement is missing its Catch or Finally block" works only one way." but not vice versa: if "The Catch or Finally statement is missing its Try block".
See also: PowerShell/PSScriptAnalyzer#2098
Expected behavior
A simular behavior for both situations, meaning:
An error when invokeing the following script:
Or visa verse (no errors at alll), knowing that a standalone
Try(e.g.:$a = try { 1 / $b }) makes more sense than a standaloneCatch.Actual behavior
Different behavior on the symmetrical situation.
Environment data