command reader: Use fast exception

The stacktrace is mostly never read, just the message is print. This makes the cli output way cleaner and improves performance.
This commit is contained in:
Moritz Zwerger 2024-02-02 20:40:51 +01:00
parent a80ced4cf1
commit fb1f460d5d
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -1,6 +1,6 @@
/* /*
* Minosoft * Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger * Copyright (C) 2020-2024 Moritz Zwerger
* *
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* *
@ -13,12 +13,13 @@
package de.bixilon.minosoft.commands.errors package de.bixilon.minosoft.commands.errors
import de.bixilon.kutil.exception.FastException
import de.bixilon.minosoft.commands.util.StringReader import de.bixilon.minosoft.commands.util.StringReader
abstract class ReaderError( abstract class ReaderError(
val reader: StringReader, val reader: StringReader,
val start: Int, val start: Int,
val end: Int, val end: Int,
) : Exception() { ) : FastException() {
override val message: String = "${this::class.simpleName} at $start-$end: ${reader.string} (at ${reader.string.substring(start, end)})" override val message: String = "${this::class.simpleName} at $start-$end: ${reader.string} (at ${reader.string.substring(start, end)})"
} }