Skip to content

Commit

Permalink
Include inner message in exception thrown from JS thread (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongin authored Sep 17, 2024
1 parent 0056dbd commit 2b7785b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/NodeApi/JSException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public JSException(JSError error) : base(error.Message)
/// This constructor must be called while still on the JS thread.
/// </remarks>
internal JSException(Exception innerException)
: this("Exception thrown from JS thread. See inner exception for details.", innerException)
: this("Exception thrown from JS thread: " + innerException?.Message, innerException)
{
JSException? innerJSException = innerException as JSException;
JSValue? jsError = innerJSException?.Error?.Value;
Expand Down
2 changes: 1 addition & 1 deletion test/NodejsEmbeddingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void ErrorPropagation()
});
});

Assert.StartsWith("Exception thrown from JS thread.", exception.Message);
Assert.Equal("Exception thrown from JS thread: test", exception.Message);
Assert.IsType<JSException>(exception.InnerException);

exception = (JSException)exception.InnerException;
Expand Down

0 comments on commit 2b7785b

Please sign in to comment.