Skip to content

Commit

Permalink
Must set error
Browse files Browse the repository at this point in the history
  • Loading branch information
ackava committed Aug 28, 2024
1 parent 0c21045 commit 53d7f3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions YantraJS.Core/Core/Error/JSError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion YantraJS.Core/Core/JSException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 53d7f3f

Please sign in to comment.