diff --git a/errorreporting/snippets/src/main/java/com/example/errorreporting/QuickStart.java b/errorreporting/snippets/src/main/java/com/example/errorreporting/QuickStart.java index b9032906131..819f564e183 100644 --- a/errorreporting/snippets/src/main/java/com/example/errorreporting/QuickStart.java +++ b/errorreporting/snippets/src/main/java/com/example/errorreporting/QuickStart.java @@ -29,12 +29,11 @@ /** * Snippet demonstrates using the Cloud Error Reporting API to report a custom error event. - *
- * This library is not required on App Engine, errors written to stderr are automatically written - * to Cloud Error Reporting. - * It is also not required if you are writing logs to Cloud Logging. - * Errors written to Cloud Logging that contain an exception or stack trace - * are automatically written out to Cloud Error Reporting. + * + *
This library is not required on App Engine, errors written to stderr are automatically written + * to Cloud Error Reporting. It is also not required if you are writing logs to Cloud Logging. + * Errors written to Cloud Logging that contain an exception or stack trace are automatically + * written out to Cloud Error Reporting. */ public class QuickStart { public static void main(String[] args) throws Exception { @@ -47,20 +46,23 @@ public static void main(String[] args) throws Exception { try (ReportErrorsServiceClient reportErrorsServiceClient = ReportErrorsServiceClient.create()) { // Custom error events require an error reporting location as well. - ErrorContext errorContext = ErrorContext.newBuilder() - .setReportLocation(SourceLocation.newBuilder() - .setFilePath("Test.java") - .setLineNumber(10) - .setFunctionName("myMethod") - .build()) - .build(); + ErrorContext errorContext = + ErrorContext.newBuilder() + .setReportLocation( + SourceLocation.newBuilder() + .setFilePath("Test.java") + .setLineNumber(10) + .setFunctionName("myMethod") + .build()) + .build(); - //Report a custom error event - ReportedErrorEvent customErrorEvent = ReportedErrorEvent.getDefaultInstance() - .toBuilder() - .setMessage("custom error event") - .setContext(errorContext) - .build(); + // Report a custom error event + ReportedErrorEvent customErrorEvent = + ReportedErrorEvent.getDefaultInstance() + .toBuilder() + .setMessage("custom error event") + .setContext(errorContext) + .build(); // Report an event synchronously, use .reportErrorEventCallable for asynchronous reporting. reportErrorsServiceClient.reportErrorEvent(projectName, customErrorEvent); } diff --git a/errorreporting/snippets/src/test/java/com/example/errorreporting/QuickStartIT.java b/errorreporting/snippets/src/test/java/com/example/errorreporting/QuickStartIT.java index 2c9e3099b46..6e7a47503b7 100644 --- a/errorreporting/snippets/src/test/java/com/example/errorreporting/QuickStartIT.java +++ b/errorreporting/snippets/src/test/java/com/example/errorreporting/QuickStartIT.java @@ -27,6 +27,6 @@ public class QuickStartIT { @Test public void testQuickStart() throws Exception { // Ensure quick start runs without any exception - QuickStart.main(new String[]{}); + QuickStart.main(new String[] {}); } }