user1017882
user1017882

Reputation:

Which method in the stack trace does the exception belong to?

In a stack trace - has the exception occurred in the last method, in the method before the last method or in the method that was to follow (i.e. it didn't get that far because of the exception)?

So, in the following example, is Method3 the method in which the exception occurred? Or is it a 'Method4' (it only got as far as completing method 3)?

STACK TRACE:
Method3()
Method2()
Method1()

Upvotes: 2

Views: 121

Answers (1)

Polyfun
Polyfun

Reputation: 9651

The exception was thrown in Method3, and the rest of the stack trace shows the calling chain to Method3. This thread shows you how to get line numbers in the stack trace too (even for release builds), which will clarify exactly where the exception is being thrown.

Upvotes: 6

Related Questions