Exception classes (#68)

This commit is contained in:
Nikolay Igotti
2016-11-17 17:56:34 +03:00
committed by GitHub
parent 8321c14e36
commit c20df35c78
2 changed files with 146 additions and 0 deletions
@@ -0,0 +1,139 @@
package kotlin
public open class Error : Throwable {
constructor() : super() {
}
constructor(message: String) : super(message) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public open class Exception : Throwable {
constructor() : super() {
}
constructor(message: String) : super(message) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public open class RuntimeException : Exception {
constructor() : super() {
}
constructor(message: String) : super(message) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public class NullPointerException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
}
public class NoSuchElementException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
}
public class IllegalArgumentException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public class IllegalStateException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public class UnsupportedOperationException : RuntimeException {
constructor() {
}
constructor(message: String) : super(message) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
constructor(cause: Throwable) : super(cause) {
}
}
public class IndexOutOfBoundsException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
}
public class ClassCastException : RuntimeException {
constructor() : super() {
}
constructor(s: String) : super(s) {
}
}
public class AssertionError : Error {
constructor() {
}
constructor(message: String) : super(message) {
}
constructor(message: String, cause: Throwable) : super(message, cause) {
}
}
@@ -12,4 +12,11 @@ public open class Throwable(open val message: String?, open val cause: Throwable
constructor(cause: Throwable?) : this(cause?.toString(), cause)
constructor() : this(null, null)
override fun toString(): String {
/* enable, once codegen is improved.
val s = "Throwable"
return if (message != null) s + ": " + message.toString() else s */
return "Throwable"
}
}