CefV8Exception.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. namespace Xilium.CefGlue
  2. {
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using System.Runtime.InteropServices;
  7. using Xilium.CefGlue.Interop;
  8. /// <summary>
  9. /// Class representing a V8 exception. The methods of this class may be called on
  10. /// any render process thread.
  11. /// </summary>
  12. public sealed unsafe partial class CefV8Exception
  13. {
  14. /// <summary>
  15. /// Returns the exception message.
  16. /// </summary>
  17. public string Message
  18. {
  19. get
  20. {
  21. var n_result = cef_v8exception_t.get_message(_self);
  22. return cef_string_userfree.ToString(n_result);
  23. }
  24. }
  25. /// <summary>
  26. /// Returns the line of source code that the exception occurred within.
  27. /// </summary>
  28. public string SourceLine
  29. {
  30. get
  31. {
  32. var n_result = cef_v8exception_t.get_source_line(_self);
  33. return cef_string_userfree.ToString(n_result);
  34. }
  35. }
  36. /// <summary>
  37. /// Returns the resource name for the script from where the function causing
  38. /// the error originates.
  39. /// </summary>
  40. public string ScriptResourceName
  41. {
  42. get
  43. {
  44. var n_result = cef_v8exception_t.get_script_resource_name(_self);
  45. return cef_string_userfree.ToString(n_result);
  46. }
  47. }
  48. /// <summary>
  49. /// Returns the 1-based number of the line where the error occurred or 0 if the
  50. /// line number is unknown.
  51. /// </summary>
  52. public int LineNumber
  53. {
  54. get { return cef_v8exception_t.get_line_number(_self); }
  55. }
  56. /// <summary>
  57. /// Returns the index within the script of the first character where the error
  58. /// occurred.
  59. /// </summary>
  60. public int StartPosition
  61. {
  62. get { return cef_v8exception_t.get_start_position(_self); }
  63. }
  64. /// <summary>
  65. /// Returns the index within the script of the last character where the error
  66. /// occurred.
  67. /// </summary>
  68. public int EndPosition
  69. {
  70. get { return cef_v8exception_t.get_end_position(_self); }
  71. }
  72. /// <summary>
  73. /// Returns the index within the line of the first character where the error
  74. /// occurred.
  75. /// </summary>
  76. public int StartColumn
  77. {
  78. get { return cef_v8exception_t.get_start_column(_self); }
  79. }
  80. /// <summary>
  81. /// Returns the index within the line of the last character where the error
  82. /// occurred.
  83. /// </summary>
  84. public int EndColumn
  85. {
  86. get { return cef_v8exception_t.get_end_column(_self); }
  87. }
  88. }
  89. }