1616
1717package com .example .errorreporting ;
1818
19- //[START errorreporting_quickstart]
19+ // [START errorreporting_quickstart]
20+ // [START error_reporting_quickstart]
21+
2022import com .google .cloud .ServiceOptions ;
2123import com .google .cloud .errorreporting .v1beta1 .ReportErrorsServiceClient ;
2224import com .google .devtools .clouderrorreporting .v1beta1 .ErrorContext ;
2628
2729/**
2830 * Snippet demonstrates using the Stackdriver Error Reporting API to report a custom error event.
29-
31+ * <p>
3032 * This library is not required on App Engine, errors written to stderr are automatically written
3133 * to Stackdriver Error Reporting.
3234 * It is also not required if you are writing logs to Stackdriver Logging.
@@ -46,21 +48,22 @@ public static void main(String[] args) throws Exception {
4648 // Custom error events require an error reporting location as well.
4749 ErrorContext errorContext = ErrorContext .newBuilder ()
4850 .setReportLocation (SourceLocation .newBuilder ()
49- .setFilePath ("Test.java" )
50- .setLineNumber (10 )
51- .setFunctionName ("myMethod" )
52- .build ())
51+ .setFilePath ("Test.java" )
52+ .setLineNumber (10 )
53+ .setFunctionName ("myMethod" )
54+ .build ())
5355 .build ();
5456
5557 //Report a custom error event
5658 ReportedErrorEvent customErrorEvent = ReportedErrorEvent .getDefaultInstance ()
57- .toBuilder ()
58- .setMessage ("custom error event" )
59- .setContext (errorContext )
60- .build ();
59+ .toBuilder ()
60+ .setMessage ("custom error event" )
61+ .setContext (errorContext )
62+ .build ();
6163 // Report an event synchronously, use .reportErrorEventCallable for asynchronous reporting.
6264 reportErrorsServiceClient .reportErrorEvent (projectName , customErrorEvent );
6365 }
6466 }
6567}
68+ // [END error_reporting_quickstart]
6669// [END errorreporting_quickstart]
0 commit comments