Skip to content

Add new MissingTryBlock rule#2179

Open
iRon7 wants to merge 1 commit intoPowerShell:mainfrom
iRon7:#2098MissingTryBlock
Open

Add new MissingTryBlock rule#2179
iRon7 wants to merge 1 commit intoPowerShell:mainfrom
iRon7:#2098MissingTryBlock

Conversation

@iRon7
Copy link
Copy Markdown

@iRon7 iRon7 commented Apr 22, 2026

PR Summary

Although #2098 didn't get an up-for-graps label, I did create the suggested Add new MissingTryBlock rule to warn when catch or finally blocks are not preceded by a try block because:

  • I think that a catch block that misses a try block is less valid than a try block that misses a catch block which causes an parse error by the engine
    • and therefore even deserves the severity Error
  • A missing try block might easily get unnoticed during design time but will very likely fail during runtime
  • It happened twice now that someone in our company tried to publish a script that was missing a try block

PR Checklist

@iRon7 iRon7 changed the title #2098 Add new MissingTryBlock rule Add new MissingTryBlock rule Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant