It's an error only when the 'when'-expression is used as a value, like assigned to a property, passed as an argument or returned from a function. Otherwise it's not an error. There's also a warning for matching enum values over an incomplete set of enum entries, but otherwise non-exhaustive 'when'-expression is green code.
You can basically consider 'when'-expressions to be syntax sugar over Java's if-else or ternary operator (?:) chains.