-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Currently R errors are forwarded via OpenCPU with full backtrace, this is not informative for users, especially because actual database errors are omitted.
I found this in the OpenCPU NEWS file:
https://github.com/opencpu/opencpu/blob/80ea353c14c8601f51ed519744149411d9cc3309/NEWS#L5-L7
2.2.11
- Errors raised by R now by default include a backtrace if available. You can
opt-out by setting 'error.backtrace' to false in your user.conf.
It seems you can turn off this backtrace behaviour by changing a value in the user.conf file. This is not documented in the server manual: https://opencpu.github.io/server-manual/opencpu-server.pdf as far as I can see.
The client package actually nicely forwards R errors, so excluding the backtrace from the error would make the difference between:
before:
Error in `get_acoustic_detections_page()`:
! Can't find acoustic_tag_id `A69-1602-47652` in: 416kHz-485, 416kHz-956, 416kHz-1141, 416kHz-1164, 416kHz-1277, 416kHz-1935, 416kHz-2066, 416kHz-2219, 416kHz-2228, 416kHz-2248, 416kHz-2485, 416kHz-2681, 416kHz-2718, 416kHz-2961, 416kHz-3305, 416kHz-3572, 416kHz-3696, 416kHz-4017, 416kHz-4155, 416kHz-4475, 416kHz-4731, 416kHz-5045, 416kHz-5079, ...
Backtrace:
▆
1. ├─evaluate::evaluate(...)
2. │ ├─base::withRestarts(...)
3. │ │ └─base (local) withRestartList(expr, restarts)
4. │ │ ├─base (local) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]])
5. │ │ │ └─base (local) doWithOneRestart(return(expr), restart)
6. │ │ └─base (local) withRestartList(expr, restarts[-nr])
7. │ │ └─base (local) withOneRestart(expr, restarts[[1L]])
8. │ │ └─base (local) doWithOneRestart(return(expr), restart)
9. │ ├─evaluate:::with_handlers(...)
10. │ │ ├─base::eval(call)
11. │ │ │ └─base::eval(call)
12. │ │ └─base::withCallingHandlers(...)
13. │ ├─base::withVisible(eval(expr, envir))
14. │ └─base::eval(expr, envir)
15. │ └─base::eval(expr, envir)
16. │ └─etnservice::get_acoustic_detections_page(...)
17. │ └─etnservice:::check_value(...)
18. │ └─assertthat::assert_that(...)
19. │ └─base::stop(assertError(attr(res, "msg")))
20. └─evaluate (local) `<fn>`(`<assrtErr>`)
21. └─watcher$push(cnd)
22. └─handler$error(value)
ℹ This is an error forwarded via the API.
Run `rlang::last_trace()` to see where the error occurred.
after:
Error in `get_acoustic_detections_page()`:
! Can't find acoustic_tag_id `A69-1602-47652` in: 416kHz-485, 416kHz-956, 416kHz-1141, 416kHz-1164, 416kHz-1277, 416kHz-1935, 416kHz-2066, 416kHz-2219, 416kHz-2228, 416kHz-2248, 416kHz-2485, 416kHz-2681, 416kHz-2718, 416kHz-2961, 416kHz-3305, 416kHz-3572, 416kHz-3696, 416kHz-4017, 416kHz-4155, 416kHz-4475, 416kHz-4731, 416kHz-5045, 416kHz-5079, ...
ℹ This is an error forwarded via the API.
Run `rlang::last_trace()` to see where the error occurred.