# Error Feedback on Validation

Add the dependency:

<dependency>
    <groupId>io.github.fhnaumann</groupId>
    <artifactId>ucumate-error-feedback</artifactId>
    <version>1.0.3-SNAPSHOT</version>
</dependency>

This will automatically inject the FeedbackValidator into the UCUMService.

The new validator tries to generate error messages with details on the invalid parts. Below is a table containing common errors that will be captured, analyzed, and explained in the error message.

Error Type Details
Spaces Anywhere UCUM does not allow spaces in expressions.
Wrong Multiplication Symbol * can be misused as the multiplication symbol while only . is allowed.
Wrong Division Symbol Albeit less common, \ can be misused as the division symbol.
Wrong Exponentiation Symbol UCUM does not have a direct exponentiation symbol. Instead they just follow on units with an optional sign.
Unknown Unit The provided unit does not match a known UCUM Unit code. It will try to match (in that order)
  • The same unit but with square brackets, i.e. ft_i matches [ft_i]
  • The case-insensitive code
  • The print symbol
  • The other names
Missing ( or ) Detects unopened or unclosed parenthesis.
Missing [ or ] Detects unopened or unclosed square brackets in units.
Missing { or } Detects unopened or unclosed curly brackets in unit annotations.
Negative Integer Number Negative integer numbers are not allowed in UCUM. Only positive integers numbers are.
Special Unit with Division Special units together with division are not allowed. Special units may only use integer multiplication or prefixes.
Special Unit with Exponent Special units are not allowed to have an exponent. Special units may only use integer multiplication or prefixes.