Re: [R] Problem with geterrmessage()

2018-02-23 Thread Martin Maechler
> Dennis Fisher > on Thu, 22 Feb 2018 13:01:37 -0800 writes: > Luke > Thanks — I revised the code to: > ERRORMESSAGE <- try(source(USERSCRIPTFILE, local=T), silent=T) > print(ERRORMESSAGE) now returns: > $value > [1] 0 > $visible

Re: [R] Problem with geterrmessage()

2018-02-22 Thread Bert Gunter
Please read ?try (again) carefully.In paticular note (under Value): "The value of the expression if expr is evaluated without error, but an invisible object of class "try-error"containing the error message, and the error condition as the "condition" attribute, if it fails." so:

Re: [R] Problem with geterrmessage()

2018-02-22 Thread Dennis Fisher
Luke Thanks — I revised the code to: ERRORMESSAGE <- try(source(USERSCRIPTFILE, local=T), silent=T) print(ERRORMESSAGE) now returns: $value [1] 0 $visible [1] FALSE Not clear what to make of that. Dennis Dennis Fisher MD P < (The "P Less Than" Company) Phone / Fax: 1-866-PLessThan

Re: [R] Problem with geterrmessage()

2018-02-22 Thread luke-tierney
Only the default error handler puts the error message in a buffer where it can be retrieved with geterrmessage. try() replaces the default error handler. Either look at the value returned by try() or use tryCatch with conditionMessage. Best, luke On Thu, 22 Feb 2018, Dennis Fisher wrote: R

[R] Problem with geterrmessage()

2018-02-22 Thread Dennis Fisher
R 3.4.3 OS X Colleagues I have a 20K line script in which I encounter an unexpected problem. If the script detects presence of a particular file USERCODE.txt, it executes: source(“USERCODE.txt”) If that file is not present, the script executes without a problem. There might be syntax