http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_exception_methods.htm#exception_common_methods 该站点显示包含 getLineNumber,但我无法使用它。谢谢
(我正在尝试查找空指针异常)
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_exception_methods.htm#exception_common_methods 该站点显示包含 getLineNumber,但我无法使用它。谢谢
(我正在尝试查找空指针异常)
堆栈跟踪包含NullPointerException
行号,因此异常应该打印它。
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...