Skip to content

Commit

Permalink
fix: throw more informative error message when no plot is generated
Browse files Browse the repository at this point in the history
fix #56
  • Loading branch information
davidgohel committed Aug 14, 2024
1 parent 5bc20a8 commit c432ce4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rvg
Type: Package
Title: R Graphics Devices for 'Office' Vector Graphics Output
Version: 0.3.3
Version: 0.3.4.001
Authors@R: c(
person("David", "Gohel", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down Expand Up @@ -31,5 +31,5 @@ LinkingTo: Rcpp, gdtools
Suggests: testthat, grid
URL: https://ardata-fr.github.io/officeverse/, https://davidgohel.github.io/rvg/
BugReports: https://github.com/davidgohel/rvg/issues
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
Roxygen: list(markdown = TRUE)
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# rvg 0.3.4

## Issues

* throw more informative error message when no plot is generated

# rvg 0.3.3

## Issues
Expand Down
5 changes: 5 additions & 0 deletions R/ph_with_vg.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ ph_with.dml <- function(x, value, location, ...) {
)

dml_str <- scan(dml_file, what = "character", quiet = T, sep = "\n", encoding = "UTF-8")

if (dml_str == "</p:grpSp>") {
stop("There was no plot output produced, can not add an empty plot to pptx document.")
}

dml_str <- paste(dml_str, collapse = "")
ph_with(x = x, value = xml2::as_xml_document(dml_str), location = location, ...)
}

0 comments on commit c432ce4

Please sign in to comment.