适配了OakInconsistentRowException
This commit is contained in:
parent
543805fb4f
commit
66913607bc
|
|
@ -19,6 +19,7 @@ import { CreateOperationData as CreateWechatUser } from '../oak-app-domain/Wecha
|
|||
import { UpdateOperationData as UpdateWechatLoginData } from '../oak-app-domain/WechatLogin/Schema';
|
||||
import { Operation as ExtraFileOperation } from '../oak-app-domain/ExtraFile/Schema';
|
||||
import {
|
||||
OakPreConditionUnsetException,
|
||||
OakRowInconsistencyException,
|
||||
OakUnloggedInException,
|
||||
OakUserException,
|
||||
|
|
@ -1645,7 +1646,7 @@ export async function switchTo<ED extends EntityDict>({ userId }: { userId: stri
|
|||
}
|
||||
const currentUserId = context.getCurrentUserId();
|
||||
if (currentUserId === userId) {
|
||||
throw new OakRowInconsistencyException(undefined, '您已经是当前用户');
|
||||
throw new OakPreConditionUnsetException('您已经是当前用户');
|
||||
}
|
||||
|
||||
const token = context.getToken()!;
|
||||
|
|
@ -1751,17 +1752,11 @@ export async function wakeupParasite<ED extends EntityDict>(
|
|||
{ dontCollect: true }
|
||||
);
|
||||
if (parasite.expired) {
|
||||
throw new OakRowInconsistencyException(
|
||||
{
|
||||
a: 's',
|
||||
d: {
|
||||
parasite: {
|
||||
[id]: pick(parasite, ['id', 'expired']),
|
||||
},
|
||||
},
|
||||
},
|
||||
const e = new OakRowInconsistencyException(
|
||||
'数据已经过期'
|
||||
);
|
||||
e.addData('parasite', [parasite]);
|
||||
throw e;
|
||||
}
|
||||
if (parasite.user?.userState !== 'shadow') {
|
||||
throw new OakUserException('此用户已经登录过系统,不允许借用身份');
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
OakUserUnpermittedException,
|
||||
OakNetworkException,
|
||||
OakServerProxyException,
|
||||
OakPreConditionUnsetException,
|
||||
} from 'oak-domain/lib/types/Exception';
|
||||
import { Cache } from 'oak-frontend-base/es/features/cache';
|
||||
import { LocalStorage } from 'oak-frontend-base/es/features/localStorage';
|
||||
|
|
@ -275,8 +276,7 @@ export class Token<ED extends EntityDict> extends Feature {
|
|||
async switchTo(userId: string) {
|
||||
const currentUserId = this.getUserId();
|
||||
if (currentUserId === userId) {
|
||||
throw new OakRowInconsistencyException(
|
||||
undefined,
|
||||
throw new OakPreConditionUnsetException(
|
||||
'您已经是当前用户'
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ const triggers: Trigger<EntityDict, 'userEntityGrant', BRC<EntityDict>>[] = [
|
|||
}
|
||||
);
|
||||
if (result2.length) {
|
||||
const e = new OakRowInconsistencyException<EntityDict>(undefined, '已领取该权限');
|
||||
const e = new OakRowInconsistencyException<EntityDict>('已领取该权限');
|
||||
e.addData('userRelation', result2);
|
||||
closeRootMode();
|
||||
throw e;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { Trigger, CreateTrigger, UpdateTrigger } from 'oak-domain/lib/types/Trig
|
|||
import { CreateOperationData as CreateWechatMpJumpData } from '../oak-app-domain/WechatMpJump/Schema';
|
||||
import { EntityDict } from '../oak-app-domain/EntityDict';
|
||||
|
||||
import { OakRowInconsistencyException, OakUserException } from 'oak-domain/lib/types';
|
||||
import { assert } from 'oak-domain/lib/utils/assert';
|
||||
import { RuntimeCxt } from '../types/RuntimeCxt';
|
||||
import { wechatMpJump } from '../aspects/wechatMpJump';
|
||||
|
|
|
|||
Loading…
Reference in New Issue