improve exceptions

This commit is contained in:
2026-01-07 22:00:32 +01:00
parent 921229aa5b
commit 2a9f086c9d
43 changed files with 137 additions and 92 deletions

View File

@@ -1,7 +1,7 @@
package com.infendro.cli.command.context
import com.infendro.cli.command.Command
import com.infendro.cli.exception.run.*
import com.infendro.cli.error.run.*
import com.infendro.cli.parser.Parser
internal class ContextParser(
@@ -19,13 +19,13 @@ internal class ContextParser(
data class Failure(
val command: Command,
val error: RuntimeError,
val error: RunError,
) : Result()
}
private fun success(context: Context) = Result.Success(context)
private fun help(command: Command) = Result.Help(command)
private fun failure(command: Command, exception: RuntimeError) = Result.Failure(command, exception)
private fun failure(command: Command, exception: RunError) = Result.Failure(command, exception)
private var index = 0
private val current: String