Skip to content

Commit 5a7244f

Browse files
dzlier-gcpaverikitsch
authored andcommitted
Add correct region tag for error_reporting_quickstart. (GoogleCloudPlatform#1304)
1 parent 6cff4eb commit 5a7244f

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

errorreporting/src/main/java/com/example/errorreporting/QuickStart.java

+13-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.example.errorreporting;
1818

19-
//[START errorreporting_quickstart]
19+
// [START errorreporting_quickstart]
20+
// [START error_reporting_quickstart]
21+
2022
import com.google.cloud.ServiceOptions;
2123
import com.google.cloud.errorreporting.v1beta1.ReportErrorsServiceClient;
2224
import com.google.devtools.clouderrorreporting.v1beta1.ErrorContext;
@@ -26,7 +28,7 @@
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

Comments
 (0)