Skip to content

Instantly share code, notes, and snippets.

@jeroenheijmans
Last active July 14, 2016 08:03
Show Gist options
  • Save jeroenheijmans/6c3507b7ef8e55d8ca3646950710fb37 to your computer and use it in GitHub Desktop.
Save jeroenheijmans/6c3507b7ef8e55d8ca3646950710fb37 to your computer and use it in GitHub Desktop.
RegEx for bad Rethrows
// This regex is a basic check to find all Catch{} blocks
// where a suspect throw statement is found (e.g. a state-
// ment that mucks up the call stack by doing `throw ex;`
// instead of `throw;`.
//
// It'll probably give false positives and have misses too.
catch[^{]*\{[^{]*throw[^;][^}]*}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment