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