52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.handler = void 0;
|
|
const Exception_1 = require("oak-domain/lib/types/Exception");
|
|
const Exception_2 = require("./types/Exception");
|
|
/**
|
|
* 构造backUrl
|
|
* @param location
|
|
* @param encode
|
|
* @returns
|
|
*/
|
|
const handler = async (reason, features) => {
|
|
if (reason instanceof Exception_1.OakException) {
|
|
if (reason instanceof Exception_1.OakUnloggedInException) {
|
|
// await features.token.logout();
|
|
features.navigator.navigateTo({
|
|
url: '/login',
|
|
}, { isGoBack: true }, true);
|
|
}
|
|
else if (reason instanceof Exception_1.OakInputIllegalException) {
|
|
features.message.setMessage({
|
|
content: reason.message,
|
|
type: 'error',
|
|
});
|
|
}
|
|
else if (reason instanceof Exception_1.OakAttrNotNullException) {
|
|
features.message.setMessage({
|
|
content: reason.message,
|
|
type: 'error',
|
|
});
|
|
}
|
|
else if (reason instanceof Exception_2.ExampleException) {
|
|
console.log('在此处理ExampleException');
|
|
}
|
|
else {
|
|
console.warn(reason);
|
|
features.message.setMessage({
|
|
content: reason.message,
|
|
type: 'error',
|
|
});
|
|
}
|
|
return true;
|
|
}
|
|
console.error(reason);
|
|
features.message.setMessage({
|
|
content: reason.message,
|
|
type: 'error',
|
|
});
|
|
return false;
|
|
};
|
|
exports.handler = handler;
|