Reputation: 193
today I had a strange problem in my serverside javascript.
I have a scriptLibrary in which I have some error-handling (try {...} catch(e) {...}) But somethings wrong with the variable "e". On the command e.printStacktrace() (which works useally) I got an exception: Error calling method 'printStackTrace()' on an object of type 'Error [JavaScript Object]'
I have another library, in which I pass the exception to a Java Class which creates a log document in my database, using it thows another exception which says that the variable "e" is not a thowable Exception. Checking that with a print(typeof e) return only "object".
Shouldn't that be a kind of exception on which I can use the standard methods? Do you have any idea what could cause that?
Thanks in advance.
Matthias
Upvotes: 0
Views: 159
Reputation: 10485
The error is not a Java Exception, this is why there is no stack information and no printStackTrace() method available.
Your code throws a Javascript error object. Try e.getMessage() or just a print(e) to get the reason for the failing of your code.
Upvotes: 2