From 53d7f3f47f2f3ca8acaf0a441064129afebe4d89 Mon Sep 17 00:00:00 2001 From: Akash Kava <39438041+ackava@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:50:38 +0530 Subject: [PATCH] Must set error --- YantraJS.Core/Core/Error/JSError.cs | 2 ++ YantraJS.Core/Core/JSException.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/YantraJS.Core/Core/Error/JSError.cs b/YantraJS.Core/Core/Error/JSError.cs index eabff840..79d73c58 100644 --- a/YantraJS.Core/Core/Error/JSError.cs +++ b/YantraJS.Core/Core/Error/JSError.cs @@ -108,6 +108,7 @@ internal protected JSError( JSObject prototype = null) : base(prototype) { this.Exception = ex; + ex.Error ??= this; this.FastAddValue(KeyStrings.message, ex.Message.Marshal(), JSPropertyAttributes.ConfigurableValue); this.FastAddValue(KeyStrings.stack, ex.JSStackTrace, JSPropertyAttributes.ConfigurableValue); } @@ -116,6 +117,7 @@ internal protected JSError( internal JSError(JSException ex, string msg) : this() { this.Exception = ex; + ex.Error ??= this; this.Message = msg; this.FastAddValue(KeyStrings.message, msg.Marshal(), JSPropertyAttributes.ConfigurableValue); this.FastAddValue(KeyStrings.stack, ex.JSStackTrace, JSPropertyAttributes.ConfigurableValue); diff --git a/YantraJS.Core/Core/JSException.cs b/YantraJS.Core/Core/JSException.cs index 046afe86..ee956f50 100644 --- a/YantraJS.Core/Core/JSException.cs +++ b/YantraJS.Core/Core/JSException.cs @@ -21,7 +21,7 @@ public override string Message } } - public JSValue Error { get; private set; } + public JSValue Error { get; internal set; } internal protected JSException With(JSValue error) {