Problem description:
If I log an error with eg. tryCatchLog() the stack trace lines are cut at a column width of 80 or similar
which makes it difficult sometimes to identify the error reason easily by looking just at the R code contained in the stack trace:
# options(width = 40)
ERROR [2020-12-04 12:35:14] [ERROR] non-numeric argument to mathematical function
Compact call stack:
1 tryCatch(tryCatchLog({
2 tryCatchLog.R#326: tryCatch(withCallingH
3 tryCatchLog.R#326: withCallingHandlers(e
4 #5: .handleSimpleError(function (c)
# options(width = 200)
ERROR [2020-12-04 12:36:13] [ERROR] non-numeric argument to mathematical function
Compact call stack:
1 tryCatch(tryCatchLog({
2 tryCatchLog.R#326: tryCatch(withCallingHandlers(expr, condition = cond.handler), ..., finally = finally)
3 tryCatchLog.R#326: withCallingHandlers(expr, condition = cond.handler)
4 #5: .handleSimpleError(function (c)
Reason:
R' internal implementation of creating a stack trace uses the function limitedLabels which cuts lines at a maxwidth of getOption("width") - 5L and "width" is 80 or 120/130 by default (R console vs. RStudio) and may not exceed the value 1000.
tryCatchLog uses a modified implementation of this function but still uses the "width" restriction.
You can change the width on a global level eg. via this code snippet
but this then applies to every R function that uses this option and may be an unwanted side effect.
Feature request:
It would be better
- to provide and use a separate option like "tryCatchLog.max.stacktrace.width"
- with a sensible default, eg. a width of 200.
Credits:
Many thanks to MS-SQL guru HSc for making this proposal!
Problem description:
If I log an error with eg.
tryCatchLog()the stack trace lines are cut at a column width of 80 or similarwhich makes it difficult sometimes to identify the error reason easily by looking just at the R code contained in the stack trace:
Reason:
R' internal implementation of creating a stack trace uses the function
limitedLabelswhich cuts lines at a maxwidth ofgetOption("width") - 5Land "width" is 80 or 120/130 by default (R console vs. RStudio) and may not exceed the value 1000.tryCatchLoguses a modified implementation of this function but still uses the "width" restriction.You can change the width on a global level eg. via this code snippet
but this then applies to every R function that uses this option and may be an unwanted side effect.
Feature request:
It would be better
Credits:
Many thanks to MS-SQL guru HSc for making this proposal!