Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 431 Bytes

ThrowingExceptionInMain.md

File metadata and controls

20 lines (13 loc) · 431 Bytes

Pattern: Throwing exception in main

Issue: -

Description

An exception should only be thrown if it can be handled by a "higher" function.

Example of incorrect code:

fun main(args: Array<String>) {
    // ...
    throw IOException() // exception should not be thrown here
}

Further Reading