perf: 用户创建证书流水线没有购买套餐或者超限时提前报错

This commit is contained in:
xiaojunnuo
2024-12-25 23:20:07 +08:00
parent f5ec9870fd
commit 472f06c2d1
13 changed files with 108 additions and 24 deletions
@@ -1,7 +1,7 @@
import { Provide } from '@midwayjs/core';
import { IWebMiddleware, IMidwayKoaContext, NextFunction } from '@midwayjs/koa';
import { IMidwayKoaContext, IWebMiddleware, NextFunction } from '@midwayjs/koa';
import { logger } from '@certd/basic';
import { BaseException, Result } from '@certd/lib-server';
import { Result } from '@certd/lib-server';
@Provide()
export class GlobalExceptionMiddleware implements IWebMiddleware {
@@ -14,11 +14,7 @@ export class GlobalExceptionMiddleware implements IWebMiddleware {
await next();
logger.info('请求完成:', url, Date.now() - startTime + 'ms');
} catch (err) {
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err.message);
if (!(err instanceof BaseException)) {
logger.error(err);
}
logger.error('请求异常:', url, Date.now() - startTime + 'ms', err);
ctx.status = 200;
if (err.code == null || typeof err.code !== 'number') {
err.code = 1;