-5

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_exception_methods.htm#exception_common_methods 该站点显示包含 getLineNumber,但我无法使用它。谢谢

(我正在尝试查找空指针异常)

4

2 回答 2

5

堆栈跟踪包含NullPointerException行号,因此异常应该打印它。

于 2014-01-16T14:08:11.863 回答
0

It's unclear what you're asking, please show some code.

getLineNumber() and getStackTraceString() should include the line number (among others). Check https://developer.salesforce.com/forums?id=906F00000008xc4IAA for sample message.

As for "how to print" - there's a try-catch example. Either simply push it at System.debug() or (if it's visualforce context) you can add a pagemessage.

You can also go to setup -> debug log, attach the tracking to your user and retry the action? You'll see the stacktrace and other goodies, line numbers next to the names of called methods...

于 2014-01-16T20:35:28.427 回答