ErrorDotStackAlreadyExists.js 945 B

1234567891011121314151617181920212223242526
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
  4. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  5. //-------------------------------------------------------------------------------------------------------
  6. try {
  7. var e = Error("123");
  8. e.somevalue = "xyz";
  9. e.stack = "abacaba";
  10. WScript.Echo("description = " + e.message);
  11. WScript.Echo("stack = " + e.stack);
  12. for (var p in e) {
  13. WScript.Echo(p + " = " + e[p]);
  14. }
  15. throw e;
  16. }
  17. catch (ex) {
  18. WScript.Echo("----------------------");
  19. WScript.Echo("description = " + e.message);
  20. WScript.Echo("stack = " + e.stack);
  21. for (var p in ex) {
  22. WScript.Echo(p + " = " + ex[p]);
  23. }
  24. }