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?
Asked
Active
Viewed 95 times
1

omerfarukdemir
- 158
- 1
- 10
-
It's not clear what you mean by converting the stack trace to a value. If my answer isn't what you're looking for, please clarify your question and let me know. – gdejohn Feb 17 '15 at 23:35
-
Your answer is ok. I didn't know the top-level function about it. – omerfarukdemir Feb 18 '15 at 13:10
2 Answers
2
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
.

gdejohn
- 7,451
- 1
- 33
- 49
1
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
.)

Gavin King
- 3,182
- 1
- 13
- 11