export function httpErrorHandler(err, req, res, next) {
    console.log("in httpErrorHandler");
    console.log(err);
    //TODO 自定义错误编码
    if (err) {
        if (err.message == "Excel文件不存在") {
            res.success({success: false, msg: err.message, code: 501});
            next();
        }
        else if (err.message == "表格不存在") {
            res.success({success: false, msg: err.message, code: 502});
            next();
        }
        else if (err.message == "Date parameter is required.") {
            res.success({success: false, msg: err.message, code: 503});
            next();
        }
        else if (err.message == "Date and sight parameters are required.") {
            res.success({success: false, msg: err.message, code: 504});
            next();
        }
        else if (err.message == "Invalid strategy type.") {
            res.success({success: false, msg: "不支持该请求", code: 505});
            next();
        }
        else {
            res.success({success:false, msg: err.message, code: 500});
            next();
        }
    }
}