Skip to content

Commit

Permalink
Add a test for errors inside promise (#1287)
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok authored Sep 20, 2019
1 parent 4f59b68 commit 7fca5ee
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/PuppeteerSharp.Tests/PageTests/EvaluateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,17 @@ public async Task ShouldTransfer100MbOfDataFromPage()
Assert.Equal(100 * 1024 * 1024, a.Length);
}

[Fact]
public async Task ShouldThrowErrorWithDetailedInformationOnExceptionInsidePromise()
{
var exception = await Assert.ThrowsAsync<EvaluationFailedException>(() =>
Page.EvaluateFunctionAsync(
@"() => new Promise(() => {
throw new Error('Error in promise');
})"));
Assert.Contains("Error in promise", exception.Message);
}

[Fact]
public async Task ShouldWorkWithDifferentSerializerSettings()
{
Expand Down

0 comments on commit 7fca5ee

Please sign in to comment.