Open-Systems-Pharmacology / OSPSuite.RUtils

Utility functions for Open Systems Pharmacology R packages
https://www.open-systems-pharmacology.org/OSPSuite.RUtils/dev/
GNU General Public License v2.0
1 stars 3 forks source link

Optional error message in `ValidateXXX` functions #135

Open Yuri05 opened 11 months ago

Yuri05 commented 11 months ago

At the moment, validate functions do not provide any information about their execution context. If validation fails, the user just gets an error message "variable XY has wrong length/type/...", e.g.

> validateIsOfLength(appliedCompoundName, 1)
Error in validateIsOfLength(appliedCompoundName, 1) : 
  validateIsOfLength: Object should be of length '1', but is of length '2' instead. 

In order to improve usability, I would extend all these function with additional (optional) string argument - error message, which would be shown to the user instead of (or additionally to?) the current error message.