Problem
An invalid ttl raises different exception types depending on where it is passed:
@cache(ttl=...) raises CacheXError;
- backends and
CacheManager (validate_ttl) raise TypeError or ValueError.
Code that validates user-supplied TTLs has to catch all three.
Proposal
Pick one convention. For example, a CacheXError subclass that also inherits from TypeError / ValueError, so existing except clauses keep working. Document it in the API reference.
Problem
An invalid
ttlraises different exception types depending on where it is passed:@cache(ttl=...)raisesCacheXError;CacheManager(validate_ttl) raiseTypeErrororValueError.Code that validates user-supplied TTLs has to catch all three.
Proposal
Pick one convention. For example, a
CacheXErrorsubclass that also inherits fromTypeError/ValueError, so existingexceptclauses keep working. Document it in the API reference.