ErrorInstance.cs 670 B

123456789101112131415161718192021222324
  1. using Jint.Collections;
  2. using Jint.Native.Object;
  3. using Jint.Runtime;
  4. using Jint.Runtime.Descriptors;
  5. namespace Jint.Native.Error
  6. {
  7. public class ErrorInstance : ObjectInstance
  8. {
  9. public ErrorInstance(Engine engine, JsString name)
  10. : base(engine, objectClass: "Error")
  11. {
  12. _properties = new StringDictionarySlim<PropertyDescriptor>(2)
  13. {
  14. ["name"] = new PropertyDescriptor(name, true, false, true)
  15. };
  16. }
  17. public override string ToString()
  18. {
  19. return Engine.Error.PrototypeObject.ToString(this, Arguments.Empty).ToObject().ToString();
  20. }
  21. }
  22. }