public class BugReport extends java.lang.Object
It allows you to configure the format and request to send the bug report.
It also contains the main entry point for all components to use the bug report system: Call intercept(Throwable)
to start handling an
exception.
You should then add some debug information there. This can be the OSM ids that caused the error, information on the data you were working on or other local variables. Make sure that no excpetions may occur while computing the values. It is best to send plain local variables to put(...). Then simply throw the throwable you got from the bug report. The global exception handler will do the rest.
int id = ...; String tag = "..."; try { ... your code ... } catch (Throwable t) { throw BugReport.intercept(t).put("id", id).put("tag", tag); }Instead of re-throwing, you can call
ReportedException.warn()
. This will display a warning to the user and allow it to either report
the execption or ignore it.Constructor and Description |
---|
BugReport(ReportedException e)
Create a new bug report
|
Modifier and Type | Method and Description |
---|---|
(package private) static java.lang.String |
getCallingMethod(int offset)
Find the method that called us.
|
static ReportedException |
intercept(java.lang.Throwable t)
This should be called whenever you want to add more information to a given exception.
|
public BugReport(ReportedException e)
e
- The ReportedException
to use. No more data should be added after creating the report.public static ReportedException intercept(java.lang.Throwable t)
t
- The throwable that was thrown.ReportedException
to which you can add additional information.static java.lang.String getCallingMethod(int offset)
offset
- How many methods to look back in the stack trace. 1 gives the method calling this method, 0 gives you getCallingMethod().