Skip to content

Commit

Permalink
chore: migrate to owlbot (#665)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Neenu1995 and gcf-owl-bot[bot] committed Sep 8, 2021
1 parent 9487430 commit 2ff1200
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@

/**
* Snippet demonstrates using the Cloud Error Reporting API to report a custom error event.
* <p>
* 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.
*
* <p>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 {
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {});
}
}

0 comments on commit 2ff1200

Please sign in to comment.