diff --git a/src/main/kotlin/com/intellij/plugin/powershell/ide/debugger/PowerShellDebugSession.kt b/src/main/kotlin/com/intellij/plugin/powershell/ide/debugger/PowerShellDebugSession.kt index ecd3e0e8..5a722a0e 100644 --- a/src/main/kotlin/com/intellij/plugin/powershell/ide/debugger/PowerShellDebugSession.kt +++ b/src/main/kotlin/com/intellij/plugin/powershell/ide/debugger/PowerShellDebugSession.kt @@ -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) + } } } }