The validUTF8() function is still in R-devel, and they probably will never export it, so let's use iconv(x, from = 'UTF-8', to = 'UTF-8') to test if x is encoded in UTF-8
also closes#1113
There are two problems I'm trying to solve here.
1) Somewhere along the way, exprToFunction gained a hardcoded
assumption that two stack frames up is a variable "expr",
meaning anything that called installExprFunction had to have
the first argument be exactly "expr". I think I got this
fixed, now the only assumption made by both installExprFunc
and exprToFunc is if they are called with quoted = FALSE,
then the caller is merely passing through code that originated
exactly one more level up the stack frame. If the code is
less than one level up, i.e. an end user is directly passing
code into installExprFunction or exprToFunction, then it won't
work; and if the code is more than one level up (someone is
passing code into function A which passes through to function
B which calls installExprFunction, with quoted = FALSE) then
it also won't work.
2) registerDebugHook calls were broken in various places by the
name/envir registered with the hook being different than the
name/envir through which the function was actually called.
This generally seems fixable by moving the registerDebugHook
call closer to the name/envir that will ultimately be called
(e.g. call registerDebugHook directly from wrapFunctionLabel).
There still seems to be a problem here in that breakpoints in
RStudio are hit but then the IDE automatically runs "n" multiple
times. Also the unit tests don't currently pass, I haven't
investigated that yet.
Validation errors were behaving too much like real errors: they were
being printed with stack traces, and passed to the options(shiny.error)
function. Also, if a reactive() cached a validation error, on future
calls the error would be re-raised (which is correct) without the
custom class names attached (which is not).
- More selective removal of frames at end of call stack
- Add withLogErrors, printError, stripStackTrace convenience funcs
- Properly capture/log errors for various levels of unhandled errors
- Unhide stacks for flush/flushed/sessionended callbacks