-
Notifications
You must be signed in to change notification settings - Fork 50
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
Should gracefully fail when an invalid colour formatter is specified #199
Comments
I'd be happy with raising a better exception, which could then be handled however you choose, but passing a non-supported format code is definitely an error and should be handled that way, so that it can be addressed properly. |
I disagree here. Because it's often used in open source tools, any error that is shipped with formatting errors interrupts the user from completing a task. The task is interrupted and the user does not have any control or remediation. Users should only see stack traces and errors when a) there is an error state in their environment (which they need to remediate) or b) there is a bug in the tool which, if it were to proceed would have unexpected and potentially disastrous results. In both cases, an error is appropriate because the tool is not able to execute the desired business logic and outcome. Formatted output, (and I'd argue other functionality like logging) are not critical errors that should interrupt the human. It is a bug, certainly, but it is a non critical bug. Interrupting the human on this 'technicality' is very disruptive and the human has no recourse except to wait for a bugfix. If the action the human is trying to accomplish is mission critical for them, then we have interrupted the workflow for no consequential reason. It is like having your prescription rejected by the pharmacist because the doctor had a spelling mistake in the pharmacy address line. Embarrassing yes, but very inconvenient to the patient. |
@lugray, A very real case and point is Shopify/shopify-cli#1388 where the developer was prevented from pushing a theme, interrupting their development flow because of a text formatting error. This cost the developer hours and it took 2weeks to repair. Treating formatting as errors, not warnings, has cost several developer-entrepreneur hundreds if not thousands of productivity dollars. |
There are two arguments now:
For {1}, I strongly maintain that the library should be generous - particularly when it is being invoked by a user. In this case it is not the developer that has integrated this library, but the end user who has a job to do. Interrupting business logic because of errors in the business logic is appropriate to avoid error states and corruption. Interrupting business logic because of cosmetic errors is not appropriate for the tool. Further, we need to be generous to the developer who is integrating this library. They don't know what they don't know. They don't know that they could be bitten (like we were) by selecting an invalid colour. Requiring that the developer have foreknowledge to capture such states is a level of cognitive load that I don't want to push on to that developer. This is why, if anything I would advocate for As for {2}, we do know that the developer likely is implementing TESTs. The |
I gave the |
Closing as stale. |
When an invalid colour is used, the formatter raises an exception and interrupts the workflow. Instead, this should be gracefully handled so the workflow is not interrupted. At most, a warning should be emitted to signal the invalid formatting.
For example:
Will cause this stack trace:
The text was updated successfully, but these errors were encountered: