qs icon indicating copy to clipboard operation
qs copied to clipboard

feature request: report filename when giving warnings

Open HedvigS opened this issue 2 years ago • 1 comments

I use qs functions to read in many files in loop/apply/map_df. It would be beneficial if warnings (like the checksum checks) also reported the file where the breakage happened, even if it's "just" a warning and not a full error.

HedvigS avatar Mar 10 '23 16:03 HedvigS

Hello, I've added the file name to relevant warnings and errors. You can test it like this:

library(qs)

# Print file name on checksum error
x <- qserialize(1, preset = "uncompressed")
x[length(x)] <- as.raw(255)
writeBin(x, con = "/tmp/temp.qs")
qread("/tmp/temp.qs")

# Warning: In file /tmp/temp.qs: Hash checksum does not match (Recorded, Computed) (4292153937,47518289), data may be corrupted

# print filename for missing file
qread("file_does_not_exist.qs")

# For file file_does_not_exist.qs: Failed to open for reading...

Hopefully will be on CRAN soon

traversc avatar Mar 31 '23 17:03 traversc

Lovely! Thank you @traversc !

HedvigS avatar Mar 19 '24 09:03 HedvigS