how to show proper exception in VBScriptEngine #336
Answered
by
ClearScriptLib
Narasimhara
asked this question in
Q&A
|
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: |
Answered by
ClearScriptLib
Jan 5, 2022
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! |
1 reply
|
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! |
1 reply
Answer selected by
Narasimhara
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


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.EnableDebuggingto the script engine constructor?Thanks!