how to show proper exception in VBScriptEngine #336
-
hi All, We have some scripts were there are exceptions. so we have to show proper exceptions. Could you please let me know how to show proper exceptions: Actual Code: the expectation is: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @Narasimhara, You could try something like this: catch (Exception exception) {
var baseException = exception.GetBaseException();
if (baseException is IScriptEngineException scriptEngineException) {
MessageBox.Show(scriptEngineException.ErrorDetails);
} else {
MessageBox.Show(baseException.Message);
}
} Good luck! |
Beta Was this translation helpful? Give feedback.
-
Hmm, it's very odd that there's no error message. Can you provide a minimal sample of the failing code? As for the stack trace, Windows script engines only provide detailed error information when debugging is enabled. Are you passing Thanks! |
Beta Was this translation helpful? Give feedback.
Hmm, it's very odd that there's no error message. Can you provide a minimal sample of the failing code?
As for the stack trace, Windows script engines only provide detailed error information when debugging is enabled. Are you passing
WindowsScriptEngineFlags.EnableDebugging
to the script engine constructor?Thanks!