From 9286b46648af75ea823f4d20a6b75f6a01b67ef6 Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Tue, 1 Oct 2024 14:00:02 -0400 Subject: [PATCH 1/2] fix(webshot): Rethrow underlying chromote errors --- R/webshot.R | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/R/webshot.R b/R/webshot.R index 50e568c..89d0f76 100644 --- a/R/webshot.R +++ b/R/webshot.R @@ -251,6 +251,7 @@ new_session_screenshot <- function( s <- NULL + err <- NULL p <- chromote$new_session(wait_ = FALSE, width = vwidth, @@ -296,8 +297,14 @@ new_session_screenshot <- function( if (!isTRUE(quiet)) message(url, " screenshot completed") normalizePath(value) })$ + catch(function(err) { + err <<- err + })$ finally(function() { - s$close() + # Close down the session if we successfully started one + if (!is.null(s)) s$close() + # Or rethrow the error if we caught one + if (!is.null(err)) signalCondition(err) }) p From a32e5f7cfff9db72a22016930708c857ca5ce58a Mon Sep 17 00:00:00 2001 From: Garrick Aden-Buie Date: Tue, 1 Oct 2024 14:01:26 -0400 Subject: [PATCH 2/2] docs: Add news item --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3880cec..a0315c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # webshot2 (development version) +* `webshot()` now surfaces errors that occur when working with the lower-level screenshot API provided by Chrome via `{chromote}`. (#69) + # webshot2 0.1.1 * `webshot()` now supports JPEG (`.jpg` or `.jpeg`) and WEBP (`.webp`) image formats. (@trafficonese #45)