Skip to content

Commit

Permalink
Debugger WIP 15
Browse files Browse the repository at this point in the history
Catch value modification errors
  • Loading branch information
Fantoom committed Aug 1, 2024
1 parent 4a27672 commit 29f73b1
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,23 @@ class PowerShellDebuggerVariableValue(val variable: Variable, val parentReferenc
if(parentReference !is Int)
return
coroutineScope.launch {
var response = server.setVariable(SetVariableArguments().apply {
variablesReference = parentReference
name = variable.name
value = expression.expression
}).await()
variable.value = response.value
variable.type = response.type ?: variable.type
variable.variablesReference = response.variablesReference ?: variable.variablesReference
variable.namedVariables = response.namedVariables ?: variable.namedVariables
variable.indexedVariables = response.indexedVariables ?: variable.indexedVariables

callback.valueModified()
try {
var response = server.setVariable(SetVariableArguments().apply {
variablesReference = parentReference
name = variable.name
value = expression.expression
}).await()
variable.value = response.value
variable.type = response.type ?: variable.type
variable.variablesReference = response.variablesReference ?: variable.variablesReference
variable.namedVariables = response.namedVariables ?: variable.namedVariables
variable.indexedVariables = response.indexedVariables ?: variable.indexedVariables

callback.valueModified()
}
catch (e: Exception) {
callback.errorOccurred(e.message ?: e.javaClass.simpleName)
}
}
}
}
Expand Down

0 comments on commit 29f73b1

Please sign in to comment.