exception.name的可靠处理

This commit is contained in:
Xu Chang 2022-11-02 20:45:37 +08:00
parent 58ac633cba
commit 165217a179
2 changed files with 8 additions and 8 deletions

View File

@ -84,16 +84,16 @@ function makeException(data) {
}
var name = data.name, message = data.message;
switch (name) {
case OakNotEnoughMoneyException.name: {
case 'OakNotEnoughMoneyException': {
return new OakNotEnoughMoneyException(message);
}
case OakDistinguishUserException.name: {
case 'OakDistinguishUserException': {
return new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message);
}
case OakUserDisabledException.name: {
case 'OakUserDisabledException': {
return new OakUserDisabledException(message);
}
case OakTokenExpiredException.name: {
case 'OakTokenExpiredException': {
return new OakTokenExpiredException(message);
}
default: {

View File

@ -87,16 +87,16 @@ export function makeException(data: {
const { name, message } = data;
switch (name) {
case OakNotEnoughMoneyException.name: {
case 'OakNotEnoughMoneyException': {
return new OakNotEnoughMoneyException(message);
}
case OakDistinguishUserException.name: {
case 'OakDistinguishUserException': {
return new OakDistinguishUserException(data.userId, data.usingPassword, data.usingIdCard, data.usingWechatUser, data.usingEmail, message);
}
case OakUserDisabledException.name: {
case 'OakUserDisabledException': {
return new OakUserDisabledException(message);
}
case OakTokenExpiredException.name: {
case 'OakTokenExpiredException': {
return new OakTokenExpiredException(message);
}
default: {