JavaScriptException.cs 779 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using Jint.Native;
  3. using Jint.Native.Error;
  4. namespace Jint.Runtime
  5. {
  6. public class JavaScriptException : Exception
  7. {
  8. private readonly JsValue _errorObject;
  9. public JavaScriptException(ErrorConstructor errorConstructor) : base("")
  10. {
  11. _errorObject = errorConstructor.Construct(Arguments.Empty);
  12. }
  13. public JavaScriptException(ErrorConstructor errorConstructor, string message)
  14. : base(message)
  15. {
  16. _errorObject = errorConstructor.Construct(new JsValue[] { message });
  17. }
  18. public JavaScriptException(JsValue error)
  19. : base("")
  20. {
  21. _errorObject = error;
  22. }
  23. public JsValue Error { get { return _errorObject; } }
  24. }
  25. }