Closed ezraporter closed 1 year ago
Looks like the solution we want :+1:
Is there any way for us to force/trigger the deleted project response in a test? I think using str_detect()
is fine here, but if for some reason Will/REDCapR were to change the message it feels a little fragile and it would be nice to easily identify a change like that.
Can we also add these to the cli_message_examples.R
file?
Description
This PR improves error messages produced by
try_redcapr()
in 2 scenarios:REDCapR
operation returns withsuccess == FALSE
but doesn't errorIn these cases we check for a few common error codes
https://github.com/CHOP-CGTInformatics/REDCapTidieR/blob/fe147b4e476c496f5ded1dfc54b4a66601ce53fc/R/utils.R#L641-L657
and otherwise issue a generic "unexpected error" message with our bug report link. This hides information
REDCapR
may have returned inoutcome_message
.This PR includes the contents of
outcome_message
in the error. See screenshot 1.REDCapR
returnssuccess == FALSE
due to a deleted projectThis is the situation that instigated investigating scenario 1. I added an explicit check for this error message to the error code checks above.
Proposed Changes
outcome_message
as theparent
inabort
when handling an unexpected errorScreenshots New unexpected error message: (Note that this won't actually ever appear because we added the explicit check for this case)
New deleted project error message:
PR Checklist
Before submitting this PR, please check and verify below that the submission meets the below criteria:
.RDS
) updated underinst/testdata/create_test_data.R
httptest::with_mock_api
and any new mocks were added totests/testthat/fixtures/create_httptest_mocks.R
usethis::use_dev_version()
Code Review
This section to be used by the reviewer and developers during Code Review after PR submission
Code Review Checklist