Skip to content

Avoid-Jumping-In-Finally

Documentation Index

Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt

Use this file to discover all available pages before exploring further.

Sourcery rule id: avoid-jumping-in-finally

Section titled “Sourcery rule id: avoid-jumping-in-finally”

Avoid the use of jump statements in finally blocks.

try {
stuff();
} finally {
for (thing of things) {
return;
}
}

Returning results or throwing exceptions in finally blocks (of try..catch..finally) suppresses propagation of unhandled exceptions. The return, break, throw, and continue statements should therefore not be used within a finally block.