Skip to content

Conversation

@dshkol
Copy link
Collaborator

@dshkol dshkol commented Jan 22, 2026

Summary

This PR improves error handling and edge case handling across multiple functions.

Changes

H9: view_cansim_webpage NULL check order

  • Check for NULL/empty before calling tolower() to prevent errors on length-0 input

H8: date_field data context fix

  • Add missing data context in pull(date_field) fallback when sample_date is NA

H10: Cache freshness check parameters

  • Save base cache path before it's overwritten by table-specific path
  • Pass correct cache_path and language to list_cansim_cached_tables()

M3: warn_only passthrough in retry helpers

  • Pass warn_only parameter through recursive retry calls in both get_with_timeout_retry and post_with_timeout_retry

M4: Route API calls through retry helpers

  • get_cansim_table_url: Use get_with_timeout_retry() instead of direct httr::GET()
  • get_cansim_changed_tables: Use get_with_timeout_retry() instead of direct httr::GET()
  • get_cansim_cube_metadata: Use post_with_timeout_retry() instead of direct httr::POST()

M8: NULL/empty vector handling in cache check

  • Handle empty vector (no matching cache entry) in addition to NA values
  • Use defensive check: !is.null() && length() > 0 && !is.na()

M9: Cache write error handling

  • Wrap saveRDS() calls in tryCatch() to log warnings on cache write failures

Test plan

  • devtools::check() passes with 0 errors, 0 warnings
  • All existing tests pass
  • Manual testing of affected functions with edge cases

Related Issues

Closes parts of #146 (Edge case crashes)
Addresses #148 (Network reliability improvements)

🤖 Generated with Claude Code

mountainMath and others added 3 commits November 19, 2025 20:22
…M8, M9)

- H9: Fix NULL/empty check order in view_cansim_webpage
- H8: Add data context to pull(date_field) when sample_date is NA
- H10: Pass correct cache_path and language to list_cansim_cached_tables
- M3: Pass warn_only through recursive retry calls in get/post helpers
- M4: Route API calls through retry helpers (get_cansim_table_url,
      get_cansim_changed_tables, get_cansim_cube_metadata)
- M8: Handle NULL/empty vector in cache freshness check
- M9: Add tryCatch error handling for cache write operations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mountainMath mountainMath changed the base branch from master to v0.4.5 January 22, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants