Skip to content

Files

Latest commit

 

History

History
23 lines (16 loc) · 538 Bytes

ReturnFromFinally.md

File metadata and controls

23 lines (16 loc) · 538 Bytes

Pattern: Use of return from finally

Issue: -

Description

Reports all return statements in finally blocks. Using return statements in finally blocks can discard and hide exceptions that are thrown in the try block.

Example of incorrect code:

fun foo() {
    try {
        throw MyException()
    } finally {
        return // prevents MyException from being propagated
    }
}

Further Reading