mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
cli: prefer deepest stack error
This commit is contained in:
parent
6e8fdb78fe
commit
dc2299368c
@ -35,13 +35,19 @@ abstract class CommandNode(
|
||||
val pointer = reader.pointer
|
||||
val stackSize = stack.size
|
||||
var lastError: Throwable? = null
|
||||
var highestStack = 0
|
||||
for (child in children) {
|
||||
try {
|
||||
return executeChild(child, reader, stack)
|
||||
} catch (error: Throwable) {
|
||||
lastError = error
|
||||
val size = stack.size
|
||||
if (size >= highestStack) {
|
||||
highestStack = size
|
||||
lastError = error
|
||||
}
|
||||
}
|
||||
reader.pointer = pointer
|
||||
|
||||
stack.reset(stackSize)
|
||||
}
|
||||
throw lastError ?: return
|
||||
|
Loading…
x
Reference in New Issue
Block a user