构造项目的exception文件
This commit is contained in:
parent
fdcc424918
commit
bbc845b01c
|
|
@ -1,6 +1,5 @@
|
|||
import { RuntimeContext as GeneralRuntimeContext } from 'oak-general-business';
|
||||
|
||||
/**
|
||||
* 若业务逻辑需要更多的上下文之间的数据传递,可以放在这里
|
||||
*/
|
||||
export interface RuntimeContext extends GeneralRuntimeContext {}
|
||||
export interface RuntimeContext {}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
import { OakException } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import { makeException as makeGeneralException } from 'oak-general-business';
|
||||
import { OakException, OakUserException } from 'oak-domain/lib/types';
|
||||
import { EntityDict } from '@oak-app-domain';
|
||||
import makeDepedentException from './DependentExceptions';
|
||||
|
||||
export class ExampleException extends OakException<EntityDict> {}
|
||||
export class ExampleException extends OakException<EntityDict> {};
|
||||
|
||||
export class ConsoleModeIllegalException extends OakException<EntityDict> {};
|
||||
|
||||
export class ConsoleLoadingDataException extends OakException<EntityDict> {};
|
||||
|
||||
export class ExistsNewBidException extends OakUserException<EntityDict> {};
|
||||
|
||||
export function makeException(msg: string | object) {
|
||||
const data = typeof msg === 'string' ? JSON.parse(msg) : msg;
|
||||
|
||||
const exception = makeGeneralException<EntityDict>(data);
|
||||
const exception = makeDepedentException(data);
|
||||
if (exception) {
|
||||
return exception;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { compareVersion } from 'oak-domain/lib/utils/version';
|
|||
|
||||
import { sdkVersion } from './configuration';
|
||||
import { features } from './initialize';
|
||||
import initializeFeatures from '@project/initializeFeatures';
|
||||
|
||||
export interface IAppOption {
|
||||
globalData: {
|
||||
|
|
@ -55,11 +56,9 @@ App<IAppOption>({
|
|||
showCancel: false,
|
||||
});
|
||||
}
|
||||
// 等application初始化完成后进行登录
|
||||
await features.application.initialize();
|
||||
if (!features.token.getTokenValue()) {
|
||||
await features.token.loginWechatMp();
|
||||
}
|
||||
features.navigator.setNamespace('/frontend');
|
||||
|
||||
await initializeFeatures(features);
|
||||
},
|
||||
|
||||
onHide() {
|
||||
|
|
@ -74,4 +73,4 @@ App<IAppOption>({
|
|||
const { reason } = rejection;
|
||||
exceptionHandler(reason, features);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import { EntityDict } from '@project/oak-app-domain';
|
||||
import { SelectOpResult } from 'oak-domain/lib/types/Entity';
|
||||
import { makeException as makeDomainException } from 'oak-domain/lib/types/Exception';
|
||||
|
||||
export default function makeException(data: {
|
||||
name: string;
|
||||
message?: string;
|
||||
opRecords: SelectOpResult<EntityDict>;
|
||||
[A: string]: any;
|
||||
}) {
|
||||
const e = makeDomainException<EntityDict>(data);
|
||||
|
||||
return e;
|
||||
}
|
||||
Loading…
Reference in New Issue