mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -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 pointer = reader.pointer
|
||||||
val stackSize = stack.size
|
val stackSize = stack.size
|
||||||
var lastError: Throwable? = null
|
var lastError: Throwable? = null
|
||||||
|
var highestStack = 0
|
||||||
for (child in children) {
|
for (child in children) {
|
||||||
try {
|
try {
|
||||||
return executeChild(child, reader, stack)
|
return executeChild(child, reader, stack)
|
||||||
} catch (error: Throwable) {
|
} catch (error: Throwable) {
|
||||||
lastError = error
|
val size = stack.size
|
||||||
|
if (size >= highestStack) {
|
||||||
|
highestStack = size
|
||||||
|
lastError = error
|
||||||
|
}
|
||||||
}
|
}
|
||||||
reader.pointer = pointer
|
reader.pointer = pointer
|
||||||
|
|
||||||
stack.reset(stackSize)
|
stack.reset(stackSize)
|
||||||
}
|
}
|
||||||
throw lastError ?: return
|
throw lastError ?: return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user