Skip to content

Commit ac90f38

Browse files
Catch warnings in .ps.graphics.createDevice() (#34)
* .ps.graphics.createDevice() turns warnings from grDevices::png() into errors * annotate error
1 parent 535110f commit ac90f38

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

crates/ark/src/lsp/modules/public/graphics.R

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ setHook("before.grid.newpage", function(...) {
4040

4141
# Create the graphics device.
4242
# TODO: Use 'ragg' if available?
43-
grDevices::png(
44-
filename = plotsPath,
45-
type = type,
46-
res = res
43+
withCallingHandlers(
44+
grDevices::png(
45+
filename = plotsPath,
46+
type = type,
47+
res = res
48+
),
49+
warning = function(w) {
50+
stop("Error creating graphics device: ", conditionMessage(w))
51+
})
4752
)
4853

4954
# Update the device name + description in the base environment.

0 commit comments

Comments
 (0)