Skip to content

Check for invalid values on the client side #588

Description

@PietrH

Currently, if you pass an invalid value to an etn function. For example: get_acoustic_detections(tag_serial_number = "not_a_tag_serial_number") the error is produced by etnservice, either locally or via OpenCPU and then forwarded to the etn package.

What happens internally is a check if the provided value is in list_tag_serial_numbers().

I've discussed this with Peter and we've come to the following conclusions:

  • This results in functions returning errors from helpers, which can be confusing for users.
  • list functions can be cached, saving on bandwidth and server capacity

We have the check_value() helper, which is posed to be removed, but offered a similar function in the past.

It might be nice to switch to rlang::arg_match(tag_serial_number, values = list_tag_serial_numbers()), this will offer a nice controllable error, originating from the correct function.

If we go this route, consideration should go to avoid repetition. Any implementation should also work for public data.

Related to: #428, #248

This came up in #409, check_value() is proposed to be removed in #360

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions