- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Accessing caught exception from Intellij debuger
Wed, 2009-05-13, 05:23
Hi
I'm a complete scala newb so I hope this is not a stupid question :)
I'm trying to write some unit tests with scala (using scalatest) and I have a problem I want to check in the debugger.
Here is the code I'm checking:
def withFixture(testFunction: (Session) => Unit) {
// get a new session
val s = getNewSession()
s.beginTransaction()
// now run the testing code
try {
testFunction(s)
s.getTransaction.commit()
}
catch {
case e =>
// cleanup
s.getTransaction().rollback()
throw e
}
}
I've added a breakopint in the last "catch" line (throw e). now the debugger stops at this line, I can access all variables except the exception (e). I don't have any "e" object. only "s", "this" and "testFunction". Even running e.printStackTrace() in the evaluation window doesn't work ("there's no such local variable e").
Is it a bug or maybe I have to access it differently?
Thaks in advance
--
Haim
I'm a complete scala newb so I hope this is not a stupid question :)
I'm trying to write some unit tests with scala (using scalatest) and I have a problem I want to check in the debugger.
Here is the code I'm checking:
def withFixture(testFunction: (Session) => Unit) {
// get a new session
val s = getNewSession()
s.beginTransaction()
// now run the testing code
try {
testFunction(s)
s.getTransaction.commit()
}
catch {
case e =>
// cleanup
s.getTransaction().rollback()
throw e
}
}
I've added a breakopint in the last "catch" line (throw e). now the debugger stops at this line, I can access all variables except the exception (e). I don't have any "e" object. only "s", "this" and "testFunction". Even running e.printStackTrace() in the evaluation window doesn't work ("there's no such local variable e").
Is it a bug or maybe I have to access it differently?
Thaks in advance
--
Haim
Here's an update:
If I assign the exception to val:
catch {
case e =>
// cleanup
s.getTransaction().rollback()
val v = e
throw e
}
Then I can access the exception through the "v" val.
Maybe it's a bug in the scala plugin. Any ideas?
Bye
On Wed, May 13, 2009 at 7:16 AM, Haim Ashkenazi <haim.ashkenazi@gmail.com> wrote:
--
Haim