[*] 日常优化
This commit is contained in:
@@ -926,7 +926,7 @@ class Taoyao {
|
|||||||
// consumer.on("trace", (trace) => {
|
// consumer.on("trace", (trace) => {
|
||||||
// console.debug("消费者跟踪事件(trace)", consumer.id, streamId, trace);
|
// console.debug("消费者跟踪事件(trace)", consumer.id, streamId, trace);
|
||||||
// });
|
// });
|
||||||
// 等待终端准备就绪:可以不用等待直接使用push方法
|
// 等待终端准备就绪:必须等待就绪不然容易导致SSRC重复异常
|
||||||
await this.request(protocol.buildMessage("media::consume", {
|
await this.request(protocol.buildMessage("media::consume", {
|
||||||
roomId,
|
roomId,
|
||||||
clientId,
|
clientId,
|
||||||
|
|||||||
@@ -220,11 +220,13 @@ public final class ErrorUtils {
|
|||||||
* @return 异常信息
|
* @return 异常信息
|
||||||
*/
|
*/
|
||||||
public static final String message(MessageCode messageCode, Throwable throwable) {
|
public static final String message(MessageCode messageCode, Throwable throwable) {
|
||||||
|
// 校验异常
|
||||||
if(throwable instanceof BindException bindException) {
|
if(throwable instanceof BindException bindException) {
|
||||||
return bindException.getAllErrors().stream()
|
return bindException.getAllErrors().stream()
|
||||||
.map(ObjectError::getDefaultMessage)
|
.map(ObjectError::getDefaultMessage)
|
||||||
.collect(Collectors.joining(" && "));
|
.collect(Collectors.joining(" && "));
|
||||||
}
|
}
|
||||||
|
// 校验异常
|
||||||
if(throwable instanceof ConstraintViolationException violationException) {
|
if(throwable instanceof ConstraintViolationException violationException) {
|
||||||
return violationException.getConstraintViolations().stream()
|
return violationException.getConstraintViolations().stream()
|
||||||
.map(ConstraintViolation::getMessage)
|
.map(ConstraintViolation::getMessage)
|
||||||
@@ -235,10 +237,10 @@ public final class ErrorUtils {
|
|||||||
if(StringUtils.isNotEmpty(message) && messageCode != MessageCode.CODE_9999) {
|
if(StringUtils.isNotEmpty(message) && messageCode != MessageCode.CODE_9999) {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
// 少量信息直接返回
|
// 不要直接返回异常堆栈信息
|
||||||
if(StringUtils.isNotEmpty(message) && message.length() <= Byte.MAX_VALUE) {
|
// if(StringUtils.isNotEmpty(message)) {
|
||||||
return message;
|
// return message;
|
||||||
}
|
// }
|
||||||
// 其他情况不能直接返回异常信息
|
// 其他情况不能直接返回异常信息
|
||||||
return messageCode.getMessage();
|
return messageCode.getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user