异常

1、所有的控件事件里,都要加一层try catch,catch里看情况加提示和写入日志表

业务逻辑里一般不加try catch ,加的话要考虑catch的处理方法,禁止catch里什么都不操作

示例

 private void frmSalesManagement_Load(object sender, EventArgs e)
        {
            try
            {
                // /////
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                SharedHeng9Factory.ErrorLogWriter.WriterErrorMessage(ex);
            }
        }

2、调用通用写错误日志的方法

  • basefrom.cs 里封装过通用的写日志的方法,可以自行查看和补充(c#)

  • SharedHeng9Factory.ErrorLogWriter.*(c#)

  • modGlobalFunction.WriteErrLogFileDB、modGlobalFunction.WriteErrLogFile、modGlobalFunction.WriteErrorMessage(VB)

3、报错日志表

  • FunctionOperateLog
  • ExceptionLog

results matching ""

    No results matching ""