Closed hafen closed 4 months ago
I think the issue is here:
It's checking
inherits(x, "simpleError")
But if you look at base errors vs. errors that come from rlang:
try_capture_stack <- RestRserve:::try_capture_stack
class(try_capture_stack(stop("test")))
# [1] "simpleError" "error" "condition"
class(try_capture_stack(rlang::abort("test")))
# [1] "rlang_error" "error" "condition"
Is there any reason that we couldn't change that line to be either:
inherits(x, "error")
or
inherits(x, c("simpleError", "rlang_error"))
I think inherits(x, "error")
should be good enough. Not sure why rlang decided to omit simpleError class.
Thanks for investigation! Would you be able a bmot a PR?
Some errors generated when using packages such as those in the tidyverse are not being caught and are getting passed through as status 200 with an empty body when they should actually be errors.
Consider the following example.
Suppose we want take a dataset and a grouping variable as inputs and do a computation like the following:
Suppose a user provides an input for a non-existent dataset:
Now suppose the user provides an input for a grouping variable that doesn't exist:
Now, if we put this in RestRserve:
In the latter case (request2), I expect to see an error, not a "200 OK" with an empty body, as there is definitely an error. These types of errors are caught using
try()
so I'm not sure why they aren't caught in server requests.Session info: