-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenable.error.line.num.R
More file actions
38 lines (37 loc) · 920 Bytes
/
Copy pathenable.error.line.num.R
File metadata and controls
38 lines (37 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#' Enable Error Line Numbers
#'
#' @name enable.error.line.num
#'
#' Enables line numbers in error messages.
#'
#' @return Invisible NULL.
#'
#' @examples
#' \dontrun{
#' # Turn on line-number reporting in error messages
#' iaw$enable.error.line.num()
#'
#' # Now errors show the source line where they occurred
#' f <- function() stop("something went wrong")
#' f()
#' }
#'
#' \dontrun{
#' # Useful at the top of a batch script for easier post-mortem debugging
#' iaw$enable.error.line.num()
#' source("my_analysis.R") # errors now include line numbers
#' }
#'
#' \dontrun{
#' # Check the current setting, enable if not already on
#' getOption("show.error.locations") # NULL or FALSE by default
#' iaw$enable.error.line.num()
#' getOption("show.error.locations") # TRUE
#' }
#'
#' @family utilities
#' @export
iaw$enable.error.line.num <- function() {
options(show.error.locations = TRUE)
invisible(NULL)
}