【优化】优化cfg日志,不再打印吓人的堆栈信息
parent
6854daec32
commit
46bc612f57
|
|
@ -44,10 +44,11 @@ Luban适合有以下需求的开发者:
|
||||||
- **====>强烈推荐查看:示例项目** ([github](https://github.com/focus-creative-games/luban_examples)) ([gitee](https://gitee.com/focus-creative-games/luban_examples)) **<====**
|
- **====>强烈推荐查看:示例项目** ([github](https://github.com/focus-creative-games/luban_examples)) ([gitee](https://gitee.com/focus-creative-games/luban_examples)) **<====**
|
||||||
|
|
||||||
- 支持与联系
|
- 支持与联系
|
||||||
- QQ群: 692890842 (Luban开发交流群)。有使用方面的疑问请及时加QQ群询问,随时有人帮助解决。
|
- QQ群: 692890842 (Luban开发交流群) [点击链接加入](https://qm.qq.com/cgi-bin/qm/qr?k=4bMoe11knBW7Tcs1sqMafZE1I4zpT4sh&jump_from=webapi)。 有使用方面的疑问请及时加QQ群询问,随时有人帮助解决。
|
||||||
- 邮箱: taojingjian#gmail.com
|
- 邮箱: taojingjian#gmail.com
|
||||||
- Skypy群: https://join.skype.com/xr2nhdMKjac0
|
- Skypy群: https://join.skype.com/xr2nhdMKjac0
|
||||||
|
|
||||||
|
|
||||||
## 特性
|
## 特性
|
||||||
- 支持增强的excel格式,可以在excel里比较简洁填写出任意复杂的数据
|
- 支持增强的excel格式,可以在excel里比较简洁填写出任意复杂的数据
|
||||||
- 支持excel族、json、xml、lua 多种数据格式,基本统一了游戏内的配置数据
|
- 支持excel族、json、xml、lua 多种数据格式,基本统一了游戏内的配置数据
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Luban.Job.Cfg.DataSources
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"文件{url} 加载失败 ==> {e.Message}", e);
|
throw new Exception($"文件{url} 加载失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"excel:{rawUrl} sheet:{reader.Name} 读取失败. ==> {e.Message}", e);
|
throw new Exception($"excel:{rawUrl} sheet:{reader.Name} 读取失败.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +73,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"excel:{rawUrl} sheet:{reader.Name} 读取失败. ==> {e.Message}", e);
|
throw new Exception($"excel:{rawUrl} sheet:{reader.Name} 读取失败.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -110,7 +110,7 @@ namespace Luban.Job.Cfg.DataSources.Excel
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"sheet:{sheet.Name} ==> {e.Message} {e.StackTrace}", e);
|
throw new Exception($"sheet:{sheet.Name}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return datas;
|
return datas;
|
||||||
|
|
|
||||||
|
|
@ -529,7 +529,7 @@ namespace Luban.Job.Cfg.Defs
|
||||||
|
|
||||||
|
|
||||||
FillValueValidator(f, e.Attribute("ref"), "ref");
|
FillValueValidator(f, e.Attribute("ref"), "ref");
|
||||||
FillValueValidator(f, e.Attribute("path"), "path"); // (ue4|normal|regex);xxx;xxx
|
FillValueValidator(f, e.Attribute("path"), "path"); // (ue4|unity|normal|regex);xxx;xxx
|
||||||
FillValueValidator(f, e.Attribute("range"), "range");
|
FillValueValidator(f, e.Attribute("range"), "range");
|
||||||
|
|
||||||
FillValidators(e, "key_validator", f.KeyValidators);
|
FillValidators(e, "key_validator", f.KeyValidators);
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,14 @@ namespace Luban.Job.Cfg
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
res.ErrCode = Luban.Common.EErrorCode.JOB_EXCEPTION;
|
res.ErrCode = Luban.Common.EErrorCode.JOB_EXCEPTION;
|
||||||
res.ErrMsg = $"{e.Message} \n {e.StackTrace}";
|
res.ErrMsg = $@"
|
||||||
|
=======================================================================
|
||||||
|
|
||||||
|
{ExceptionUtil.ExtractMessage(e)}
|
||||||
|
|
||||||
|
=======================================================================
|
||||||
|
";
|
||||||
|
res.StackTrace = e.StackTrace;
|
||||||
}
|
}
|
||||||
DefAssemblyBase.LocalAssebmly = null;
|
DefAssemblyBase.LocalAssebmly = null;
|
||||||
timer.EndPhaseAndLog();
|
timer.EndPhaseAndLog();
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ namespace Luban.Job.Cfg.Utils
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"配置文件:{originFile} 生成失败. ==> {e.Message}", e);
|
throw new Exception($"配置文件:{originFile} 生成失败.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -220,7 +220,7 @@ namespace Luban.Job.Cfg.Utils
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception($"load text table file:{files[i]} fail. ==> {e.Message} ");
|
throw new Exception($"load text table file:{files[i]} fail", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Luban.Job.Common.Utils
|
||||||
|
{
|
||||||
|
public static class ExceptionUtil
|
||||||
|
{
|
||||||
|
public static string ExtractMessage(Exception e)
|
||||||
|
{
|
||||||
|
var lines = new List<string>();
|
||||||
|
do
|
||||||
|
{
|
||||||
|
lines.Add("===> " + e.Message);
|
||||||
|
e = e.InnerException;
|
||||||
|
} while (e != null);
|
||||||
|
|
||||||
|
return string.Join('\n', lines);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -215,7 +215,8 @@ namespace Luban.Job.Proto
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
res.ErrCode = Luban.Common.EErrorCode.JOB_EXCEPTION;
|
res.ErrCode = Luban.Common.EErrorCode.JOB_EXCEPTION;
|
||||||
res.ErrMsg = $"{e.Message} \n {e.StackTrace}";
|
res.ErrMsg = ExceptionUtil.ExtractMessage(e);
|
||||||
|
res.StackTrace = e.StackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefAssemblyBase.LocalAssebmly = null;
|
DefAssemblyBase.LocalAssebmly = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue