-
Notifications
You must be signed in to change notification settings - Fork 28
fix(根据ID查询属性值命令): 优化 #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix(根据ID查询属性值命令): 优化 #103
Conversation
| public String getId() { | ||
| return super.getId(); | ||
| return Optional.ofNullable(super.getId()) | ||
| .orElseThrow(() -> new IllegalArgumentException("设备ID不能为空")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.使用ValidationException
2. 国际化
| public String getId() { | ||
| return Optional.ofNullable(super.getId()) | ||
| .orElseThrow(() -> new IllegalArgumentException("设备ID不能为空")); | ||
| .orElseThrow(() -> new ValidationException.NoStackTrace(LocaleUtils.resolveMessage("device.queryPropertyLatestCommand.param.error"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new ValidationException.NoStackTrace("id","validation.NotNull.deviceId")
| public String getId() { | ||
| return super.getId(); | ||
| return Optional.ofNullable(super.getId()) | ||
| .orElseThrow(() -> new ValidationException.NoStackTrace("id", LocaleUtils.resolveMessage("validation.NotNull.deviceId"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不需要resolveMessage
@zhou-hao