Add error, with link, for passing Quantity to unit slot #327
Labels
⬇️ affects: documentation
Improvements or additions to documentation
📁 kind: enhancement
New feature or request
💪 effort: small
Imagine trying to round some size to the nearest 10 bytes:
This works (it gives
bytes(1230)
). However, users might try writing something like this:If so, they might get an error like this:
That's not the best. It does say that
IsUnit<...Quantity...>
isn't satisfied, but it's not as straightforward as it could be.We could instead turn
AssociatedUnit<Quantity<...>>
into a hard compiler error, with a readable message. Something like this:That seems better: we can directly tell them that they're passing a Quantity to a unit slot, and link them to documentation on unit slots. Actually, probably even better would be to make a new entry in the troubleshooting page.
The text was updated successfully, but these errors were encountered: