-
-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce ConsoleMessage.Location (#919)
* Some progress * Introduce ConsoleMessage.Location * CodeFactor + Test
- Loading branch information
Showing
9 changed files
with
142 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace PuppeteerSharp | ||
{ | ||
/// <summary> | ||
/// Console message location. | ||
/// </summary> | ||
public class ConsoleMessageLocation : IEquatable<ConsoleMessageLocation> | ||
{ | ||
/// <summary> | ||
/// URL of the resource if known. | ||
/// </summary> | ||
public string URL { get; set; } | ||
|
||
/// <summary> | ||
/// Line number in the resource if known. | ||
/// </summary> | ||
public int? LineNumber { get; set; } | ||
|
||
/// <summary> | ||
/// Column number in the resource if known. | ||
/// </summary> | ||
public int? ColumnNumber { get; set; } | ||
|
||
/// <inheritdoc/> | ||
public bool Equals(ConsoleMessageLocation other) | ||
=> (URL, LineNumber, ColumnNumber) == (other?.URL, other?.LineNumber, other?.ColumnNumber); | ||
|
||
/// <inheritdoc/> | ||
public override bool Equals(object obj) => Equals(obj as ConsoleMessageLocation); | ||
|
||
/// <inheritdoc/> | ||
public override int GetHashCode() | ||
=> 412870874 + | ||
EqualityComparer<string>.Default.GetHashCode(URL) + | ||
EqualityComparer<int?>.Default.GetHashCode(LineNumber) + | ||
EqualityComparer<int?>.Default.GetHashCode(ColumnNumber); | ||
|
||
/// <inheritdoc/> | ||
public static bool operator ==(ConsoleMessageLocation location1, ConsoleMessageLocation location2) | ||
=> EqualityComparer<ConsoleMessageLocation>.Default.Equals(location1, location2); | ||
|
||
/// <inheritdoc/> | ||
public static bool operator !=(ConsoleMessageLocation location1, ConsoleMessageLocation location2) | ||
=> !(location1 == location2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace PuppeteerSharp.Messaging | ||
{ | ||
internal class StackTrace | ||
{ | ||
public ConsoleMessageLocation[] CallFrames { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters