-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve messages from add/updateRecord()
functions
#28
Comments
How about a package wide option to turn off the messages? I've refactored the code in my fork and this should be simple to do. options(activityInfoAPIVerbose = FALSE) Here's one package specific implementation with helper functions: Perhaps a vignette that explains how to capture and log messages to their own file, e.g. with tryCatchLog. I have created a specific condition class for the messages/errors returned from the API calls so one could separetely log just those status/code messages. add/updateRecord could return the record ID. It will throw an error on failure. We may need to be careful with changing return values to be sure not to break exisiting scripts. I was surprised to find that updateSchema returns the whole database structure instead of the specific schema which could have been made into an ActivityInfo schema object but perhaps some people are using this return value. |
add/updateRecord()
functionsadd/updateRecord()
functions
Creating a new issue to have addRecord fail if the record has already been added |
Return the recordId or s3 class with both recordId and formId (recordRef with an s3 class) |
this is a more general point about the messages across all functions so not just related to this issue. My idea for these issues were that the not-helpful API messages would be deleted and the 'new' messages were going to replace them completely. is there a way to not show the API |
another example from using with both the this also kind of ties into discussions going forward for #37 because if it's successful, but we're not looking for a returned object, then we need more consistency on what the API is returning besides the messages that are given in the console . but again, we can continue that discussion in that other issue |
I think we can silence these easily as they are just three lines in the
three functions to get, post, and put resources.
…On Thu, Dec 15, 2022, 12:35 Ryo Nakagawara ***@***.***> wrote:
another example using addDatabaseUser():
[image: addUser-messages]
<https://user-images.githubusercontent.com/19657164/207849062-494d5ba2-ab8c-4682-821b-9648b137a406.PNG>
—
Reply to this email directly, view it on GitHub
<#28 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOP4AA6L4P6Y7J7HQK4KCTWNL7BDANCNFSM6AAAAAASLC6IB4>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
Addressed in 4.30 |
The default options in 4.30 are as follows:
This then only provides the richer task based messaging with the relevant object IDs for each request. If you set |
A successful upload of
add/updateRecord()
returns aNULL
when trying to save the output as an object. Below is the output from when I wrappurrr::safely()
toupdateRecord()
and the update succeeds without issue:While there is the
Sending POST request to … resources/update
and theOK (HTTP 200)
messages that appear in the console, these messages aren't returned and can't be saved as objects. I have to go out of my way to usecapture.output()
to grab these messages but the outcome is less than ideal as the strings aren't formatted properly.Current message that shows up in the console:
Sending POST request to … resources/update
is unhelpful to user as they don't really give meaningful info. Could be replaced with something like:Updating/Adding record ID: __(id)__ in Form: __(id or label)__
Basically anything that can tell me what exactly is being acted on in the API/database. Also compared to other functions, when
add/updateRecord()
is successful it doesn't actually return anything. I would rather have it return some 'text' whether it's the message example provided above or something similar:Record ID: __(id)__ in Form: __(id or label)__ OK! (HTTP 200)
Good example of something similar that already exists is the message one gets when running
getFormSchema()
:Of course, when
getFormSchema()
is successful, it returns the actual schema object, so I don't need the message returned as an object with the result. This was just to show what I would likeadd/updateRecord()
's messages to look more like.The good thing is that the form/record IDs/labels are all created as R objects inside the
add/updateRecord()
functions themselves OR they are directly passed into the functions as arguments so it wouldn't be hard to create the proper message texts as the info already exists inside the function itself.The text was updated successfully, but these errors were encountered: