yuruguo opened a new pull request #12828:
URL: https://github.com/apache/pulsar/pull/12828
### Motivation
Check the validity of the time-related option in CLI tools and give a more
friendly / concise prompt message when time invaild. Currently, it directly
display the exception stack info as below:
```
bin/pulsar tokens create -sk file:///x/y/my-secret.key -s role -e 7z
Exception in thread "main" java.lang.IllegalArgumentException: Invalid time
unit 'z'
at
org.apache.pulsar.common.util.RelativeTimeUtil.parseRelativeTimeInSeconds(RelativeTimeUtil.java:63)
at
org.apache.pulsar.utils.auth.tokens.TokensCliUtils$CommandCreateToken.run(TokensCliUtils.java:158)
at
org.apache.pulsar.utils.auth.tokens.TokensCliUtils.main(TokensCliUtils.java:327)
```
### Modifications
- Throw `ParameterException` when `IllegalArgumentException` occurs when
executing `RelativeTimeUtil.parseRelativeTimeInSeconds()`
### Documentation
Automatically generate doc through code
- [x] `doc`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]