Exception classes (#68)
This commit is contained in:
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user