Exception stacktrace

Enonic version: 6.6.1
OS: OsX El Capitain

Hello,

I’m wondering, how can I access the stacktrace of my exception, when handling it from error.js?
On the documentation it states that the request.exception should contain an actual java exception, but all I’m getting is a string.

Can you guys help me out here?
Thanks!

It seems that we are setting a string in the exception property, the result of calling toString() on the Java Exception object. Looks like a bug.

What are you trying to do? I think it’s a bit fragile to handle errors based on the stacktrace.

1 Like

We have fixed the exception property for error.js, so it will contain the Java Exception object as expected.
The fix will be in 6.7 version, which will be released very soon.

Thanks!
I’m creating an email alert whenever a certain exception code is triggered, and would also like to view the stack, instead of having to go thru the console.

1 Like

Wouldn’t this be better served as JSON than a Java object?

1 Like

I thought about it, we could convert the whole stacktrace and chain of exceptions. But I was not sure it is a good idea to encourage app developers to rely on stacktraces for error handling.
It was also a quickfix to include the minimum we had documented in 6.7. We can consider it for 6.8.

2 Likes