DiagnosticUtility.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System.Diagnostics;
  2. namespace System.Runtime.Serialization {
  3. internal static class DiagnosticUtility {
  4. internal static bool ShouldTraceError = true;
  5. internal static bool ShouldTraceWarning;
  6. internal static bool ShouldTraceInformation;
  7. internal static bool ShouldTraceVerbose = true;
  8. internal static class DiagnosticTrace {
  9. internal static void TraceEvent (params object [] args)
  10. {
  11. }
  12. }
  13. internal static class ExceptionUtility {
  14. internal static Exception ThrowHelperError (Exception e)
  15. {
  16. return ThrowHelper (e, TraceEventType.Error);
  17. }
  18. internal static Exception ThrowHelperCallback (string msg, Exception e)
  19. {
  20. return new CallbackException (msg, e);
  21. }
  22. internal static Exception ThrowHelperCallback (Exception e)
  23. {
  24. return new CallbackException ("Callback exception", e);
  25. }
  26. internal static Exception ThrowHelper (Exception e, TraceEventType type)
  27. {
  28. return e;
  29. }
  30. internal static Exception ThrowHelperArgument (string arg)
  31. {
  32. return new ArgumentException (arg);
  33. }
  34. internal static Exception ThrowHelperArgument (string arg, string message)
  35. {
  36. return new ArgumentException (message, arg);
  37. }
  38. internal static Exception ThrowHelperArgumentNull (string arg)
  39. {
  40. return new ArgumentNullException (arg);
  41. }
  42. internal static Exception ThrowHelperFatal (string msg, Exception e)
  43. {
  44. return new FatalException (msg, e);
  45. }
  46. }
  47. }
  48. }