Skip to content

Instantly share code, notes, and snippets.

@CheolhoJeon
Created June 18, 2021 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CheolhoJeon/a7eff5c6e3201a8564b13b6ff85b6561 to your computer and use it in GitHub Desktop.
Save CheolhoJeon/a7eff5c6e3201a8564b13b6ff85b6561 to your computer and use it in GitHub Desktop.
package chap6.ExceptionHandling
import atomictest.capture
class Exception1(
val value: Int
): Exception("wrong value: $value")
open class Exception2(
description: String
): Exception(description)
class Exception3(
description: String
): Exception2(description)
fun main() {
capture {
throw Exception1(13)
} eq "Exception1: wrong value: 13"
capture {
throw Exception3("error")
} eq "Exception3: error"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment