ErrorEvent.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. namespace Update.Core.Events
  3. {
  4. /// <summary>
  5. /// 错误事件类型
  6. /// </summary>
  7. /// <param name="sender"></param>
  8. /// <param name="e"></param>
  9. public delegate void ErrorEventHandler(object sender, ErrorEventArgs e);
  10. /// <summary>
  11. /// 错误时间数据
  12. /// </summary>
  13. public class ErrorEventArgs : EventArgs
  14. {
  15. /// <summary>
  16. /// 错误
  17. /// </summary>
  18. public Exception Error { get; private set; }
  19. /// <summary>
  20. /// 构造函数
  21. /// </summary>
  22. /// <param name="error"></param>
  23. public ErrorEventArgs(Exception error)
  24. {
  25. this.Error = error;
  26. }
  27. /// <summary>
  28. /// 构造函数
  29. /// </summary>
  30. /// <param name="error"></param>
  31. public ErrorEventArgs(string error)
  32. {
  33. this.Error = new Exception(error);
  34. }
  35. /// <summary>
  36. /// 构造函数
  37. /// </summary>
  38. /// <param name="format"></param>
  39. /// <param name="args"></param>
  40. public ErrorEventArgs(string format, params object[] args)
  41. {
  42. this.Error = new Exception(string.Format(format, args));
  43. }
  44. }
  45. }