omerfarukdemir
omerfarukdemir

Reputation: 158

Convert a stack trace to a value

I want to get Throwable.getStackTrace() result as a value in Ceylon. Java interface has printStackTrace method with parameter PrintWriter, but Ceylon Throwable interface has not. How can i get it?

Upvotes: 1

Views: 99

Answers (2)

Gavin King
Gavin King

Reputation: 4263

There's no true equivalent of Java's Throwable.getStackTrace() in the Ceylon language module because we wouldn't be able to implement that operation in JavaScript.

Therefore, I've just added the javaStackTrace() function to the module ceylon.interop.java, and that will be available in the 1.2 release of the platform.

(As already answered by @gdejohn, there's also the printStackTrace() function in ceylon.language.)

Upvotes: 1

gdejohn
gdejohn

Reputation: 7579

Similar to java.lang.Throwable.printStackTrace(PrintWriter), Ceylon's language module has the top-level function void printStackTrace(Throwable, Anything(String)). You provide the exception and a function which accepts a String.

Upvotes: 2

Related Questions