How to obtain the value of 'error. code' in Java
Closed this issue · 4 comments
rongrong1000 commented
In Java
public static void main(String[] args) {
try {
V8Runtime v8Runtime = V8Host.getNodeInstance().createV8Runtime();
v8Runtime.getExecutor("""
require('nohave')
""").executeVoid();
} catch (JavetException e) {
e.printStackTrace();
}
}
I have 'JavetException e', how can I obtain the value of 'code'
In Nodejs
try {
require('nohave')
} catch (e) {
console.log('code: ' + e.code)
}
print: code: MODULE_NOT_FOUND
rongrong1000 commented
I found it in 'e.getScriptingError(). getContext() .getContext()'
Does it have the potential to become a property of 'JavetScriptingError' in the future
rongrong1000 commented
caoccao commented
Everything is in the context. code
doesn't exist in ECMAScript, so there is no API level support.
rongrong1000 commented
I understand