From 9e59d0058f30d5209e6b161d425571996448d0b7 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Tue, 2 Apr 2024 09:47:40 -0400 Subject: [PATCH] Make `description` a bit more robust --- src/dataset.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/dataset.jl b/src/dataset.jl index 77a737a..1b87ee3 100644 --- a/src/dataset.jl +++ b/src/dataset.jl @@ -44,8 +44,12 @@ This object prints well in the REPL, and can also be shown as markdown or HTML. This function is left deliberately unexported, since the name is pretty common. """ function description(package_name::AbstractString, dataset_name::AbstractString) - RDatasetDescription(read(joinpath(@__DIR__, "..", "doc", - package_name, "$dataset_name.html"), String)) + doc_html_file = joinpath(@__DIR__, "..", "doc", package_name, "$dataset_name.html") + if isfile(doc_html_file) + return RDatasetDescription(read(doc_html_file, String)) + else + return RDatasetDescription("No description available.") + end end # This is a convenience function to get the description of a dataset from a DataFrame.