Skip to content

Commit

Permalink
show the error message instead of the code (a minor issue discovered …
Browse files Browse the repository at this point in the history
…while looking at #97)
  • Loading branch information
yihui committed Jan 14, 2025
1 parent 870bef7 commit 60c3bb9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: xfun
Type: Package
Title: Supporting Functions for Packages Maintained by 'Yihui Xie'
Version: 0.50.3
Version: 0.50.4
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")),
person("Wush", "Wu", role = "ctb"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- `tojson()` supports more types of data now, and will indent sub-elements for lists. See the help page [`?xfun::tojson`](https://git.yihui.org/xfun/manual.html#sec:man-tojson) for details.

- `upload_imgur()` shows the error message instead of the error code when it fails to upload the image, which is more informative.

# CHANGES IN xfun VERSION 0.50

- The function `isFALSE()` has been removed from this package. The deprecation notice was given two years ago: https://yihui.org/en/2023/02/xfun-isfalse/
Expand Down
2 changes: 1 addition & 1 deletion R/image.R
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ upload_imgur = function(
if (length(link) != 1) stop(
'Failed to upload ', file, sprintf(' (reason: %s)', if (is.character(res)) {
grep_sub('.*<error>([^<]+)</error>.*', '\\1', res)
} else res[[1]]$error[[1]])
} else res[[c('data', 'error', 'message')]][[1]])
)
if (include_xml) structure(link, XML = res) else link
}

0 comments on commit 60c3bb9

Please sign in to comment.