inst/doc/error_reporting_in_api.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(googleErrorReportingR)

## -----------------------------------------------------------------------------
message <- googleErrorReportingR::format_error_message()
message$serviceContext$service <- "api_name"
message$serviceContext$version <- "api_version"

## ----eval=FALSE, include=TRUE-------------------------------------------------
#  error_catcher_from_function <- tryCatch(
#    your_function(your_parameters),
#    error = function(e) {
#      message$message <- as.character(e)
#      googleErrorReportingR::report_error(message)
#      stop("Error message to print", call. = FALSE)
#    })

Try the googleErrorReportingR package in your browser

Any scripts or data that you put into this service are public.

googleErrorReportingR documentation built on Oct. 27, 2022, 5:07 p.m.