/IronPython_Main/Languages/IronPython/IronPython/Runtime/Exceptions/PythonException.cs

# · C# · 58 lines · 51 code · 7 blank · 0 comment · 0 complexity · 6188807d1f950eab52524d017039a4b6 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Runtime.Serialization;
  5. using Microsoft.Scripting.Runtime;
  6. namespace IronPython.Runtime.Exceptions {
  7. [Serializable]
  8. class PythonException : Exception, IPythonAwareException {
  9. private object _pyExceptionObject;
  10. private List<DynamicStackFrame> _frames;
  11. private TraceBack _traceback;
  12. public PythonException() : base() { }
  13. public PythonException(string msg) : base(msg) { }
  14. public PythonException(string message, Exception innerException)
  15. : base(message, innerException) {
  16. }
  17. #if !SILVERLIGHT // SerializationInfo
  18. protected PythonException(SerializationInfo info, StreamingContext context) : base(info, context) { }
  19. #endif
  20. object IPythonAwareException.PythonException {
  21. get {
  22. return _pyExceptionObject;
  23. }
  24. set {
  25. _pyExceptionObject = value;
  26. }
  27. }
  28. List<DynamicStackFrame> IPythonAwareException.Frames {
  29. get { return _frames; }
  30. set { _frames = value; }
  31. }
  32. TraceBack IPythonAwareException.TraceBack {
  33. get { return _traceback; }
  34. set { _traceback = value; }
  35. }
  36. }
  37. interface IPythonAwareException {
  38. object PythonException {
  39. get;
  40. set;
  41. }
  42. List<DynamicStackFrame> Frames {
  43. get;
  44. set;
  45. }
  46. TraceBack TraceBack {
  47. get;
  48. set;
  49. }
  50. }
  51. }