nus-cs2103-AY2223S1 / pe-dev-response

0 stars 0 forks source link

Error message confusing for catching wrong input add task command #5576

Open nus-pe-bot opened 1 year ago

nus-pe-bot commented 1 year ago

It is acceptable to wrap task description in " " or ' ' but not for " ', which is fine, but the error message throws a wrong statement with reference to the error.

Steps to reproduce: add task "do something' -c cs2100

image.png


[original: nus-cs2103-AY2223S1/pe-interim#5462] [original labels: type.FeatureFlaw severity.Low]

domoberzin commented 1 year ago

Team's Response

Thanks for bringing this up.

The program behavior is correct and working as intended. The true underlying cause here is the unterminated " - we take whatever is between the starting quote " and the accompanying ending quote " (or EOL the end of line if it is absent) as the argument at face value.

We do not try to interpret what is meant by the quoted argument (hence the at face value) because the user could have intended to add a task specifically with -c cs2100 in it (and we should not assume otherwise). Predicting user intent is beyond the scope of the feature (see #5508 for a similar but not identical explanation).

As such we take do this ' -c cs2100 as your task name, and hence the module code is in fact unspecified, and the error message is correct.


Here's a screenshot of a task added specifically with the name do this ' -c cs2100 to show that it is possible:

Screenshot 2022-11-14 at 00.11.55.png


We concede that we could probably mandate escaping the dash - to include it in the name and then also treat unescaped dashes as a parameter, but seeing as this is a very rare edge case and that the program functions just fine and does not crash, and fails gracefully with an error message as seen, we deem such an implementation to be beyond the scope of this feature. Not to mention that it would also be non-trivial to implement a fully POSIX compliant command parser.

Duplicate status (if any):

--