Skip to content

Commit 1f8589c

Browse files
committed
Use callWith() for simpler debugging with dots
1 parent 3b97002 commit 1f8589c

7 files changed

+23
-18
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Suggests:
2424
Remotes:
2525
github::kwb-r/kwb.utils
2626
Encoding: UTF-8
27-
RoxygenNote: 7.2.3
27+
RoxygenNote: 7.3.1
2828
Config/testthat/edition: 3

R/getObservationRecordsFromEuLines.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ getObservationRecordsFromEuLines <- function(
1313
)
1414

1515
if (kwb.utils::isTryError(observations)) {
16-
headerInfo <- getHeaderInfo(eu_lines)
17-
observations <- extractObservationData(
18-
eu_lines,
19-
headerInfo,
20-
header.info,
16+
observations <- kwb.utils::callWith(
17+
extractObservationData,
18+
euLines = eu_lines,
19+
headerInfo = getHeaderInfo(eu_lines),
20+
header.info = header.info,
2121
file = file,
22-
...
22+
if (interactive()) list() else list(...)
2323
)
2424
}
2525

R/getObservationsFromEuLines.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ readObservationsFromCsvText <- function(text, sep, dec, quote, colClasses, ...)
154154
colClasses <- colClasses[colNames]
155155
}
156156

157-
utils::read.table(
157+
kwb.utils::callWith(
158+
utils::read.table,
158159
text = text,
159160
sep = sep,
160161
dec = dec,
@@ -163,7 +164,7 @@ readObservationsFromCsvText <- function(text, sep, dec, quote, colClasses, ...)
163164
blank.lines.skip = FALSE,
164165
stringsAsFactors = FALSE,
165166
colClasses = colClasses,
166-
...
167+
if (interactive()) list() else list(...)
167168
)
168169
}
169170

R/readAndMergeEuCodedFiles.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ readAndMergeEuCodedFiles <- function(
3333
{
3434
# by setting simple.algorithm = FALSE we get unique column names, e.g. "ADE"
3535
# and "ADE.1"
36-
inspection.data.list <- readEuCodedFiles(
36+
inspection.data.list <- kwb.utils::callWith(
37+
readEuCodedFiles,
3738
input.files = input.files,
3839
dbg = dbg,
3940
name.convention = name.convention,
4041
simple.algorithm = FALSE,
41-
...
42+
if (interactive()) list() else list(...)
4243
)
4344

4445
result <- mergeInspectionData(inspection.data.list)

R/readEuCodedFile.R

+3-2
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ readEuCodedFile <- function(
104104

105105
observations <- run(
106106
"Extracting observation records",
107-
getObservationRecordsFromEuLines(
107+
kwb.utils::callWith(
108+
getObservationRecordsFromEuLines,
108109
eu_lines = eu_lines,
109110
header.info = header.info,
110111
dbg = dbg,
111112
file = input.file,
112-
...
113+
if (interactive()) list() else list(...)
113114
)
114115
)
115116

R/readEuCodedFiles.R

+6-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ readEuCodedFiles <- function(
3333
"input file %d/%d: %s\n", i, length(input.files), input.file
3434
))
3535

36-
inspectionData <- try(
37-
readEuCodedFile(input.file, dbg = dbg, ...),
38-
silent = TRUE
39-
)
36+
inspectionData <- try(silent = TRUE, kwb.utils::callWith(
37+
readEuCodedFile,
38+
input.file = input.file,
39+
dbg = dbg,
40+
if (interactive()) list() else list(...)
41+
))
4042

4143
# Return the error object if an error occurred
4244
if (kwb.utils::isTryError(inspectionData)) {

R/writeEuCodedFiles.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ writeEuCodedFile <- function(
9494
output.lines <- kwb.utils::catAndRun(
9595
"Formatting lines",
9696
dbg = dbg,
97-
toEuFormat(inspection.data, version, dbg = dbg)
97+
toEuFormat(inspection.data, version, dbg = dbg, ...)
9898
)
9999

100100
if (is.null(output.file)) {

0 commit comments

Comments
 (0)