dot-report_api_error: Report an API-call error with full context

.report_api_errorR Documentation

Report an API-call error with full context

Description

Internal helper that standardizes the message every WNBA / ESPN / NCAA wrapper emits inside its tryCatch(error = ...) block. Always emits, in order:

Usage

.report_api_error(e, hint = NULL, args = list())

Arguments

e

error condition (the e from ⁠function(e)⁠ in tryCatch).

hint

character. A friendly message with optional {name} tokens that resolve against the caller's environment (so {game_id} etc. pull from the wrapper's formals). If NULL, defaults to "Request failed".

args

optional named list of caller arguments to dump (typically mget(setdiff(names(formals()), "...")) captured at function entry).

Details

  1. A timestamped friendly hint (brace-interpolated against the caller env),

  2. A dump of the function call's arguments,

  3. The actual error message (conditionMessage(e)).

Functions opt in by capturing their formals once near the top — .args <- mget(setdiff(names(formals()), "...")) — and then calling .report_api_error(e, hint = "...", args = .args) from the error handler.

Value

Invisibly NULL. Called for its side effects.


wehoop documentation built on Aug. 25, 2026, 1:06 a.m.