Scoop API

scoop:scoop.core:0.1.0

src/throwable.scoop

Selected production source · src/throwable.scoop

1// Exception hierarchy defined by language spec section 11.7.
2// Throwable / Exception are `open` so user code can define custom
3// exceptions; the built-in subclasses are final.
5/**
6 * The common reference base for values that can be thrown and caught.
7 */
8@Intrinsic("core_throwable")
9public open class Throwable public constructor() {
10 /**
11 * Prints the first throw's physical stack, or reports that no stack was captured.
12 * With enable-stack-trace disabled, reports that stack traces are unavailable.
13 * Source debug builds enable stack traces by default; release builds disable them.
14 */
15 public final fun printStackTrace(): Unit {
16 __scoopPrintThrowableStackTrace(this)
17 }
20@Intrinsic("throwable_print_stack_trace")
21private fun __scoopPrintThrowableStackTrace(exception: Throwable): Unit
23/**
24 * An ordinary throwable carrying an optional human-readable message.
25 */
26public open class Exception public constructor(
27 /**
28 * Optional explanatory text; None means no message was supplied.
29 */
30 public val message: String?) : Throwable()
32/**
33 * Thrown when a forced optional unwrap encounters None.
34 */
35public class UnwrapException public constructor() : Exception(Some("unwrap on None"))
37/**
38 * Thrown when a checked cast cannot produce the requested runtime type.
39 */
40public class ClassCastException public constructor() : Exception(Some("invalid cast"))
42/**
43 * Reports an invalid checked arithmetic operation, including integer division by zero.
44 */
45public class ArithmeticException public constructor() : Exception(Some("arithmetic error"))
47/**
48 * Reports a required context value that is absent at runtime.
49 */
50public class MissingContextException public constructor(message: String?) : Exception(message)
52/**
53 * Reports an index or slice boundary outside the valid range.
54 */
55public class IndexOutOfBoundsException public constructor() : Exception(Some("array index out of bounds"))
57/**
58 * Reports an argument that violates an operation's preconditions.
59 */
60public class IllegalArgumentException public constructor(message: String? = Some("illegal argument")) : Exception(message)
62/**
63 * Reports an operation invalid for the object's current state.
64 */
65public class IllegalStateException public constructor(message: String? = Some("illegal state")) : Exception(message)
67/**
68 * Reports malformed UTF-8 and the byte offset where validation failed.
69 */
70public class CharacterCodingException public constructor(
71 /**
72 * The zero-based byte offset associated with the invalid encoding.
73 */
74 public val byteOffset: Long) : Exception(Some("invalid UTF-8"))
76internal fun __scoopThrowInitializationCycle(message: String) {
77 throw IllegalStateException(Some(message))