Skip to content

Commit e8cf3e5

Browse files
committed
Update for knitr
1 parent 718db20 commit e8cf3e5

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

common.R

+11-13
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,19 @@ section_strip <- function(path) {
120120
# Errors ------------------------------------------------------------------
121121

122122
# Make error messages closer to base R
123-
registerS3method("wrap", "error", envir = asNamespace("knitr"),
124-
function(x, options) {
125-
msg <- conditionMessage(x)
126-
127-
call <- conditionCall(x)
128-
if (is.null(call)) {
129-
msg <- paste0("Error: ", msg)
130-
} else {
131-
msg <- paste0("Error in ", deparse(call)[[1]], ": ", msg)
132-
}
123+
sew.error <- function(x, options) {
124+
msg <- conditionMessage(x)
133125

134-
msg <- error_wrap(msg)
135-
knitr:::msg_wrap(msg, "error", options)
126+
call <- conditionCall(x)
127+
if (is.null(call)) {
128+
msg <- paste0("Error: ", msg)
129+
} else {
130+
msg <- paste0("Error in ", deparse(call)[[1]], ": ", msg)
136131
}
137-
)
132+
133+
msg <- error_wrap(msg)
134+
knitr:::msg_wrap(msg, "error", options)
135+
}
138136

139137
error_wrap <- function(x, width = getOption("width")) {
140138
lines <- strsplit(x, "\n", fixed = TRUE)[[1]]

0 commit comments

Comments
 (0)