Skip to content

Files

Latest commit

 

History

History
23 lines (16 loc) · 465 Bytes

ThrowingExceptionFromFinally.md

File metadata and controls

23 lines (16 loc) · 465 Bytes

Pattern: Throwing exception from finally

Issue: -

Description

Throwing exceptions from a finally block should be avoided as it can lead to confusion and discarded exceptions.

Example of incorrect code:

fun foo() {
    try {
        // ...
    } finally {
        throw IOException()
    }
}

Further Reading