fix(admin,api): 上分超额提示而非静默截断,并返回中文业务错误
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -20,7 +20,16 @@ export class GlobalExceptionFilter implements ExceptionFilter {
|
||||
if (exception instanceof HttpException) {
|
||||
status = exception.getStatus();
|
||||
const res = exception.getResponse();
|
||||
message = typeof res === 'string' ? res : (res as { message?: string }).message || message;
|
||||
if (typeof res === 'string') {
|
||||
message = res;
|
||||
} else if (typeof res === 'object' && res !== null) {
|
||||
const body = res as { message?: string | string[] };
|
||||
if (Array.isArray(body.message)) {
|
||||
message = body.message.join(';');
|
||||
} else if (typeof body.message === 'string' && body.message.trim()) {
|
||||
message = body.message;
|
||||
}
|
||||
}
|
||||
} else if (exception instanceof Error) {
|
||||
message = exception.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user