Skip to content

Commit

Permalink
chore: refactoring comments
Browse files Browse the repository at this point in the history
fix typo in the comment.
expand the comment about error context autopopulation.
address lint warning for errors.New() call.
  • Loading branch information
minherz committed Sep 14, 2023
1 parent e5a3667 commit 84f5dbc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions errorreporting/errorreporting_quickstart/main.go
Expand Up @@ -44,23 +44,24 @@ func main() {
ServiceName: "errorreporting_quickstart",
ServiceVersion: "0.0.0",
OnError: func(err error) {
log.Printf("Could not repport the error: %v", err)
log.Printf("Could not report the error: %v", err)
},
})
if err != nil {
log.Fatal(err)
}
defer errorClient.Close()

err = errors.New("Something went wrong")
err = errors.New("something went wrong")
if err != nil {
logAndPrintError(err)
return
}
}

func logAndPrintError(err error) {
// error context is autopopulated
/// Client autopopulates the error context of the error. For more details about the context see:
/// https://cloud.google.com/error-reporting/reference/rest/v1beta1/ErrorContext
errorClient.Report(errorreporting.Entry{
Error: err,
})
Expand Down

0 comments on commit 84f5dbc

Please sign in to comment.