Skip to content

Commit df1b3cb

Browse files
Neenu1995gcf-owl-bot[bot]
authored andcommitted
chore: migrate to owlbot (#665)
* chore: migrate to owlbot * chore: fix typos * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: fix typos * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 5d2fb16 commit df1b3cb

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@
2929

3030
/**
3131
* Snippet demonstrates using the Cloud Error Reporting API to report a custom error event.
32-
* <p>
33-
* This library is not required on App Engine, errors written to stderr are automatically written
34-
* to Cloud Error Reporting.
35-
* It is also not required if you are writing logs to Cloud Logging.
36-
* Errors written to Cloud Logging that contain an exception or stack trace
37-
* are automatically written out to Cloud Error Reporting.
32+
*
33+
* <p>This library is not required on App Engine, errors written to stderr are automatically written
34+
* to Cloud Error Reporting. It is also not required if you are writing logs to Cloud Logging.
35+
* Errors written to Cloud Logging that contain an exception or stack trace are automatically
36+
* written out to Cloud Error Reporting.
3837
*/
3938
public class QuickStart {
4039
public static void main(String[] args) throws Exception {
@@ -47,20 +46,23 @@ public static void main(String[] args) throws Exception {
4746
try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) {
4847

4948
// Custom error events require an error reporting location as well.
50-
ErrorContext errorContext = ErrorContext.newBuilder()
51-
.setReportLocation(SourceLocation.newBuilder()
52-
.setFilePath("Test.java")
53-
.setLineNumber(10)
54-
.setFunctionName("myMethod")
55-
.build())
56-
.build();
49+
ErrorContext errorContext =
50+
ErrorContext.newBuilder()
51+
.setReportLocation(
52+
SourceLocation.newBuilder()
53+
.setFilePath("Test.java")
54+
.setLineNumber(10)
55+
.setFunctionName("myMethod")
56+
.build())
57+
.build();
5758

58-
//Report a custom error event
59-
ReportedErrorEvent customErrorEvent = ReportedErrorEvent.getDefaultInstance()
60-
.toBuilder()
61-
.setMessage("custom error event")
62-
.setContext(errorContext)
63-
.build();
59+
// Report a custom error event
60+
ReportedErrorEvent customErrorEvent =
61+
ReportedErrorEvent.getDefaultInstance()
62+
.toBuilder()
63+
.setMessage("custom error event")
64+
.setContext(errorContext)
65+
.build();
6466
// Report an event synchronously, use .reportErrorEventCallable for asynchronous reporting.
6567
reportErrorsServiceClient.reportErrorEvent(projectName, customErrorEvent);
6668
}

errorreporting/snippets/src/test/java/com/example/errorreporting/QuickStartIT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public class QuickStartIT {
2727
@Test
2828
public void testQuickStart() throws Exception {
2929
// Ensure quick start runs without any exception
30-
QuickStart.main(new String[]{});
30+
QuickStart.main(new String[] {});
3131
}
3232
}

0 commit comments

Comments
 (0)